<div dir="ltr">Hi, Guys<div><br></div><div>We have a Apache Spark cluster of 3 nodes, one is master and slave, the other two are slaves. When starting Spark worker with "systemctl start spark-worker", when running out apps, sometimes but not always it generates "<span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px">java.lang.OutOfMemoryError: unable to create new native thread" error in Spark worker logs.</span></div><div><span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px">If instead starting Spark worker directly (</span>/opt/spark/<span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px">sbin/start-slave.sh spark://masterip:7077), it never causes any such error.</span></div><div><span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px">We tried tweaking ulimit and java options but did not have any luck.</span></div><div><span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px"><br></span></div><div><font color="#000000" face="calibri, sans-serif"><span style="font-size:14px">The unit file (spark-worker.service) is like below:</span></font></div><div><div>[Unit]</div><div>Description=Spark Worker</div><div>After=network.target</div><div><br></div><div>[Service]</div><div>Type=forking</div><div>ExecStart=/opt/spark/sbin/start-slave.sh spark://masterIP:7077</div><div>ExecStop=/opt/spark/sbin/stop-slave.sh</div><div>StandardOutput=journal</div><div>StandardError=journal</div><div>LimitNOFILE=infinity</div><div>LimitMEMLOCK=infinity</div><div>LimitNPROC=infinity</div><div>LimitAS=infinity</div><div>CPUAccounting=true</div><div>CPUShares=100</div><div>Restart=always</div><div><br></div><div>[Install]</div><div>WantedBy=multi-user.target</div></div><div><br></div><div>Any help is appreciated.</div><div><br></div><div>Thanks,</div><div>Rao</div><div><span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:calibri,sans-serif;font-size:14px"><br></span></div></div>