java.lang.OutOfMemoryError: unable to create new native thread in the log file. I've checked the memory and it uses 500 mb out of 1.5gb allocated. I searched the net and found that it could be caused by too many threads. I've done a thread dump and found that the node called "utils" has *1074 threads* that look like this: {panel} ComThread for Thread-1022 "ComThread for Thread-1022" Id=1497 Group=main RUNNABLE (in native)

Jenkins JIRA | Markus | 5 years ago
  1. 0

    I run frequent scripts on a node called "utils" using the groovy CLI to communicate with Jenkins. After a couple of hours, the CLI stops working. I've found several java.lang.OutOfMemoryError: unable to create new native thread in the log file. I've checked the memory and it uses 500 mb out of 1.5gb allocated. I searched the net and found that it could be caused by too many threads. I've done a thread dump and found that the node called "utils" has *1074 threads* that look like this: {panel} ComThread for Thread-1022 "ComThread for Thread-1022" Id=1497 Group=main RUNNABLE (in native) at com4j.Win32Lock.suspend0(Native Method) at com4j.Win32Lock.suspend(Win32Lock.java:33) at com4j.ComThread.run0(ComThread.java:135) at com4j.ComThread.run(ComThread.java:125) {panel} Finally, Jenkins crashes with out of memory. Attached is the thread dump. Any ideas? It started around the time when I finally understood how the groovy CLI scripts work and added a few of them. ------------------- The groovy scripts I run are: {noformat} Thread.getAllStackTraces().keySet().each() { item -> if (item.getName().contains("SCM polling") && item.getName().contains("waiting for hudson.remoting")) { println "Interrupting thread " + item.getId(); item.interrupt() } } {noformat} {noformat} def slaves = hudson.model.Hudson.instance.getNodes() for (slave in slaves) { def comp = slave.getComputer() def executors = comp.getExecutors() if (executors != null ) { for (executor in executors) { def workunit = executor.getCurrentWorkUnit() if (workunit != null) { def subtask = workunit.work println "Slavename:" + slave.getDisplayName() + ";Task:BUSY:" + subtask.getDisplayName() } else { println "Slavename:" + slave.getDisplayName() + ";Task:IDLE" } } } } {noformat} {noformat} def slaves = hudson.model.Hudson.instance.getNodes() for (slave in slaves) { def comp = slave.getComputer() if (comp.isOnline()) { println "Name:" + comp.getName() + "; Status: ONLINE; Hostname:" + comp.getHostName() + "; Idle:" + comp.countIdle() } else{ println "Name:" + comp.getName() + "; Status: OFFLINE; Hostname:NA" + "; Idle:0" } } {noformat}

    Jenkins JIRA | 5 years ago | Markus
    java.lang.OutOfMemoryError: unable to create new native thread in the log file. I've checked the memory and it uses 500 mb out of 1.5gb allocated. I searched the net and found that it could be caused by too many threads. I've done a thread dump and found that the node called "utils" has *1074 threads* that look like this: {panel} ComThread for Thread-1022 "ComThread for Thread-1022" Id=1497 Group=main RUNNABLE (in native)
  2. 0

    I run frequent scripts on a node called "utils" using the groovy CLI to communicate with Jenkins. After a couple of hours, the CLI stops working. I've found several java.lang.OutOfMemoryError: unable to create new native thread in the log file. I've checked the memory and it uses 500 mb out of 1.5gb allocated. I searched the net and found that it could be caused by too many threads. I've done a thread dump and found that the node called "utils" has *1074 threads* that look like this: {panel} ComThread for Thread-1022 "ComThread for Thread-1022" Id=1497 Group=main RUNNABLE (in native) at com4j.Win32Lock.suspend0(Native Method) at com4j.Win32Lock.suspend(Win32Lock.java:33) at com4j.ComThread.run0(ComThread.java:135) at com4j.ComThread.run(ComThread.java:125) {panel} Finally, Jenkins crashes with out of memory. Attached is the thread dump. Any ideas? It started around the time when I finally understood how the groovy CLI scripts work and added a few of them. ------------------- The groovy scripts I run are: {noformat} Thread.getAllStackTraces().keySet().each() { item -> if (item.getName().contains("SCM polling") && item.getName().contains("waiting for hudson.remoting")) { println "Interrupting thread " + item.getId(); item.interrupt() } } {noformat} {noformat} def slaves = hudson.model.Hudson.instance.getNodes() for (slave in slaves) { def comp = slave.getComputer() def executors = comp.getExecutors() if (executors != null ) { for (executor in executors) { def workunit = executor.getCurrentWorkUnit() if (workunit != null) { def subtask = workunit.work println "Slavename:" + slave.getDisplayName() + ";Task:BUSY:" + subtask.getDisplayName() } else { println "Slavename:" + slave.getDisplayName() + ";Task:IDLE" } } } } {noformat} {noformat} def slaves = hudson.model.Hudson.instance.getNodes() for (slave in slaves) { def comp = slave.getComputer() if (comp.isOnline()) { println "Name:" + comp.getName() + "; Status: ONLINE; Hostname:" + comp.getHostName() + "; Idle:" + comp.countIdle() } else{ println "Name:" + comp.getName() + "; Status: OFFLINE; Hostname:NA" + "; Idle:0" } } {noformat}

    Jenkins JIRA | 5 years ago | Markus
    java.lang.OutOfMemoryError: unable to create new native thread in the log file. I've checked the memory and it uses 500 mb out of 1.5gb allocated. I searched the net and found that it could be caused by too many threads. I've done a thread dump and found that the node called "utils" has *1074 threads* that look like this: {panel} ComThread for Thread-1022 "ComThread for Thread-1022" Id=1497 Group=main RUNNABLE (in native)
  3. 0

    Frequent Out of Memory in the node where the Hazelcast Monitor is deployed

    Google Groups | 6 years ago | Mohan
    java.lang.OutOfMemoryError: Java heap space Mar 17, 2011 6:31:46 PM com.hazelcast.nio.AbstractSerializer SEVERE: Java heap space Could you help find out the reason, the tool is very much useful to us but at the same time we are unable to find the reason of it getting oom. I've generated the Thread dump and there are 64 threads waiting for monitoring entry related to Network operation, "ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" daemon prio=3 tid=0x007d2480 nid=0x52 waiting for monitor entry [0xc2e7f000..0xc2e7fb70]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    editing an XML file causes IDEA to hang on Linux

    YouTrack | 10 years ago
    java.lang.OutOfMemoryError: PermGen space Note that IDEA has plenty of memory... 40M of 169M shown on the display at time of hang... (and my project is tiny...) Here is the thread dump: Full thread dump Java HotSpot(TM) 64-Bit Server VM (1.5.0_11-b03 mixed mode): "AWT-EventQueue-1" prio=1 tid=0x00002aaad0152300 nid=0x283 waiting for monitor entry [0x0000000042 777000..0x0000000042777d80]
  6. 0

    Java running out of memory on VPS

    Stack Overflow | 3 years ago | user2789433
    java.lang.OutOfMemoryError: Java heap space</p> <p>I don't understand why such an error would occur after hours instead of few minutes if there is a memory leak. I used tools such as VisualVM to observe the behavior of the program and the memory runs constant throughout. </p> <p>Is anyone aware of any ways I can debug this and get to the bottom of this or how to avoid it?</p> <p>Is there a tool that requires no installation and can observe the memory usage of a process over ssh?</p> <p>Edit: There is no stack trace on all the exceptions which is weird. But the error happens in different threads for different classes. </p> <pre><code>at java.io.BufferedWriter.&lt;init&gt;(BufferedWriter.java:104) at java.io.BufferedWriter.&lt;init&gt;(BufferedWriter.java:87)

    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 in the log file. I've checked the memory and it uses 500 mb out of 1.5gb allocated. I searched the net and found that it could be caused by too many threads. I've done a thread dump and found that the node called "utils" has *1074 threads* that look like this: {panel} ComThread for Thread-1022 "ComThread for Thread-1022" Id=1497 Group=main RUNNABLE (in native)

      at com4j.Win32Lock.suspend0()
    2. com4j
      ComThread.run
      1. com4j.Win32Lock.suspend0(Native Method)
      2. com4j.Win32Lock.suspend(Win32Lock.java:33)
      3. com4j.ComThread.run0(ComThread.java:135)
      4. com4j.ComThread.run(ComThread.java:125)
      4 frames