java.lang.OutOfMemoryError: unable to create new native thread

Jenkins JIRA | Travis Graham | 3 years ago
  1. 0

    I received the following error when Jenkins was attempting to connect to a slave via SSH. [SLAVE] Starting Virtual Machine...[SLAVE] Reverting to snapshot:jenkins_test[SLAVE] Powering on VM[SLAVE] Waiting for VMTools[SLAVE] Finished wait for VMTools[07/30/13 05:30:59] [SSH] Opening SSH connection to SLAVE:22. [07/30/13 05:30:59] [SSH] Authentication successful. ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins. java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:691) at com.trilead.ssh2.Connection.exec(Connection.java:1520) at hudson.plugins.sshslaves.SSHLauncher.verifyNoHeaderJunk(SSHLauncher.java:608) at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:490) at org.jenkinsci.plugins.vSphereCloudLauncher.launch(vSphereCloudLauncher.java:198) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:222) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) [07/30/13 05:30:59] [SSH] Connection closed. This was being caused by Jenkins attempting to exceed the number of filehandles it was allowed by the system. This seems to be caused by Jenkins not releasing the TCP connection to the slave box when there is no traffic between the boxes. Our current setup using the vSphere Cloud Plugin is to start a job on that slave and when it is completed rollback to a previous snapshot and connect to the slave again. Each time this occurs Jenkins opens a new TCP connection but never releases the old one. The only way to clear these is to restart the application. java 22547 jenkins 365w IPv4 110621531 0t0 TCP jenkinsmaster:58371->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 367u IPv4 110611457 0t0 TCP jenkinsmaster:58020->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 368u IPv4 110612511 0t0 TCP jenkinsmaster:58038->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 369u IPv4 110616112 0t0 TCP jenkinsmaster:58072->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 371u IPv4 110585709 0t0 TCP jenkinsmaster:57697->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 372u IPv4 110625368 0t0 TCP jenkinsmaster:58552->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 421u IPv4 110629766 0t0 TCP jenkinsmaster:58578->jenkinsslave:ssh (ESTABLISHED)

    Jenkins JIRA | 3 years ago | Travis Graham
    java.lang.OutOfMemoryError: unable to create new native thread
  2. 0

    I received the following error when Jenkins was attempting to connect to a slave via SSH. [SLAVE] Starting Virtual Machine...[SLAVE] Reverting to snapshot:jenkins_test[SLAVE] Powering on VM[SLAVE] Waiting for VMTools[SLAVE] Finished wait for VMTools[07/30/13 05:30:59] [SSH] Opening SSH connection to SLAVE:22. [07/30/13 05:30:59] [SSH] Authentication successful. ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins. java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:691) at com.trilead.ssh2.Connection.exec(Connection.java:1520) at hudson.plugins.sshslaves.SSHLauncher.verifyNoHeaderJunk(SSHLauncher.java:608) at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:490) at org.jenkinsci.plugins.vSphereCloudLauncher.launch(vSphereCloudLauncher.java:198) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:222) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) [07/30/13 05:30:59] [SSH] Connection closed. This was being caused by Jenkins attempting to exceed the number of filehandles it was allowed by the system. This seems to be caused by Jenkins not releasing the TCP connection to the slave box when there is no traffic between the boxes. Our current setup using the vSphere Cloud Plugin is to start a job on that slave and when it is completed rollback to a previous snapshot and connect to the slave again. Each time this occurs Jenkins opens a new TCP connection but never releases the old one. The only way to clear these is to restart the application. java 22547 jenkins 365w IPv4 110621531 0t0 TCP jenkinsmaster:58371->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 367u IPv4 110611457 0t0 TCP jenkinsmaster:58020->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 368u IPv4 110612511 0t0 TCP jenkinsmaster:58038->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 369u IPv4 110616112 0t0 TCP jenkinsmaster:58072->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 371u IPv4 110585709 0t0 TCP jenkinsmaster:57697->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 372u IPv4 110625368 0t0 TCP jenkinsmaster:58552->jenkinsslave:ssh (ESTABLISHED) java 22547 jenkins 421u IPv4 110629766 0t0 TCP jenkinsmaster:58578->jenkinsslave:ssh (ESTABLISHED)

    Jenkins JIRA | 3 years ago | Travis Graham
    java.lang.OutOfMemoryError: unable to create new native thread
  3. 0

    OutOfMemory After Running for Hours

    GitHub | 4 years ago | jilen
    java.lang.OutOfMemoryError: unable to create new native thread
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Exception in thread "Thread-39"

    GitHub | 5 years ago | Kaos1337
    java.lang.OutOfMemoryError: unable to create new native thread
  6. 0

    Why does max number of threads decrease when I increase max heap size?

    Stack Overflow | 4 years ago | Evgeniy Dorofeev
    java.lang.OutOfMemoryError: unable to create new native thread

  1. Reich 4 times, last 2 weeks ago
  2. Ajeet 46 times, last 4 months ago
  3. Diogo Jaym 1 times, last 5 months ago
  4. brunosatriani 2 times, last 6 months ago
  5. Bardh 4 times, last 7 months ago
1 more registered users
29 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.OutOfMemoryError

    unable to create new native thread

    at java.lang.Thread.start0()
  2. Java RT
    Thread.start
    1. java.lang.Thread.start0(Native Method)
    2. java.lang.Thread.start(Thread.java:691)
    2 frames
  3. Trilead
    Connection.exec
    1. com.trilead.ssh2.Connection.exec(Connection.java:1520)
    1 frame
  4. hudson.plugins.sshslaves
    SSHLauncher.launch
    1. hudson.plugins.sshslaves.SSHLauncher.verifyNoHeaderJunk(SSHLauncher.java:608)
    2. hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:490)
    2 frames
  5. org.jenkinsci.plugins
    vSphereCloudLauncher.launch
    1. org.jenkinsci.plugins.vSphereCloudLauncher.launch(vSphereCloudLauncher.java:198)
    1 frame
  6. Hudson
    SlaveComputer$1.call
    1. hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:222)
    1 frame
  7. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:166)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    5. java.lang.Thread.run(Thread.java:722)
    5 frames