Profile Image
janarthanan

I've uploaded five samples collected every 20 seconds & thread pool keeps growing infinitely

the respecive microservice goes from healthy 1/1 state to 0/1 state with java lang out of memory error - unable to create native threads.. As seen with multiple thread dump, the number of waiting threads goes higher and higher. The problem is couldnt figure out the calling point from the thread stacktrace, Any help on how to debug this problem further is appreciated. I do have heap dump collected few seconds after this error happened.

This is how stacktrace of all those waiting threads.

NetworkUpdateProcessorPool-%d

priority : 5

thread Id : 0x00007f1ea4188000

native Id : 0x601

native Id (decimal) : 1537

state : WAITING


stackTrace:
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park(java.base@11.0.7/Native Method)
- parking to wait for <0x00000006c206e3b0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(java.base@11.0.7/LockSupport.java:194)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@11.0.7/AbstractQueuedSynchronizer.java:2081)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@11.0.7/ScheduledThreadPoolExecutor.java:1170)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@11.0.7/ScheduledThreadPoolExecutor.java:899)
at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.7/ThreadPoolExecutor.java:1054)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.7/ThreadPoolExecutor.java:1114)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.7/ThreadPoolExecutor.java:628)
at java.lang.Thread.run(java.base@11.0.7/Thread.java:834)

 

Report URL - https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjIvMDQvMTEvLS10aHJlYWRfZHVtcF8yMDIyLjA0LjExLTEwLjIwLjE3LjgxMDM4MTM4Ny0tMTUtMTgtMzs7LS10aHJlYWRfZHVtcF8yMDIyLjA0LjExLTEwLjIxLjQzLjQ5OTU2Nzk4NC0tMTUtMTgtMzs7LS10aHJlYWRfZHVtcF8yMDIyLjA0LjExLTEwLjIxLjE5LjE0NTI0MjkzOS0tMTUtMTgtMzs7LS10aHJlYWRfZHVtcF8yMDIyLjA0LjExLTEwLjIwLjQyLjM5MDI0MzkxOC0tMTUtMTgtMzs7LS10aHJlYWRfZHVtcF8yMDIyLjA0LjExLTEwLjIyLjA3LjgwOTQ5MzIxNi0tMTUtMTgtMw==

  • threadpoolkeepsgrowinginfinitely

  • blockingthreads

  • javalangoutofmemoryerror

  • unabletocreatenativethreads

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Janarthanan!

 

 Greetings.
 
 I looked in to your thread dump and I am seeing following sources of problem(s):
 
 a. You have thread pool by name: 'NetworkUpdateProcessorPool'. This thread pool keeps growing infinitely. In the thread dump that you captured at 10:20:19, this thread pool had 7398 threads. Here 6651 threads are in WAITING state (ie not doing anything). Can you confirm whether any max thread pool limit is set on this thread pool? Looks like no max thread pool size is set. 

 

2. I do see java.util.TimeZone is blocking 305 threads:

 

 

 Below is the stack of the 'NetworkUpdateProcessorPool' thread which is holding on to 'java.util.TimeZone' class and not releasing it:

 

java.lang.Thread.State: BLOCKED (on object monitor)
at java.util.TimeZone.getTimeZone(java.base@11.0.7/TimeZone.java:517)
- locked <0x00000006c015fb50> (a java.lang.Class for java.util.TimeZone)
at ch.qos.logback.contrib.json.JsonLayoutBase.formatTimestamp(Unknown Source)
at ch.qos.logback.contrib.json.JsonLayoutBase.addTimestamp(Unknown Source)
at ch.qos.logback.contrib.json.classic.JsonLayout.toJsonMap(Unknown Source)
at ch.qos.logback.contrib.json.classic.JsonLayout.toJsonMap(Unknown Source)
at ch.qos.logback.contrib.json.JsonLayoutBase.doLayout(Unknown Source)
at ch.qos.logback.core.encoder.LayoutWrappingEncoder.encode(LayoutWrappingEncoder.java:115)
at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:230)
at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:102)
at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.info(Logger.java:591)
at com.xxxxx.tms.processor.tasks.TopologyOMSLinkProcessorTask.run(TopologyOMSLinkProcessorTask.java:39)
at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.7/Executors.java:515)
at java.util.concurrent.FutureTask.run(java.base@11.0.7/FutureTask.java:264)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(java.base@11.0.7/ScheduledThreadPoolExecutor.java:304)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.7/ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.7/ThreadPoolExecutor.java:628)
at java.lang.Thread.run(java.base@11.0.7/Thread.java:834)

 If you notice 'java.util.TimeZone' is invoked by the Logback (qos.ch) logging framework. Can you investigate whether you are running on a older version of Logback framework and Logback has introduced any new version to fix this problem?

 

c. Janarthanan - here is a another strong suspicion: If repeated garbage collection runs it can also stall (i.e. halt the application). To confirm that we need to capture and analyze GC logs. Did you capture GC log?

 

You can use the open source yCrash script which will capture 360-degree application level artifacts (like GC logs, 3 snapshots of thread dumps, heap dumps) and system level artifacts (like top, top -H, netstat, vmstat, iostat, dmesg, diskusage, kernel parameters...). Once you have these data, either you can manually analyze them or upload it to yCrash tool, which will analyze all these artifacts and generate one unified root cause analysis marrying all these artifacts. It may indicate the root cause of the problem.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • threadpoolkeepsgrowinginfinitely

  • blockingthreads

  • javalangoutofmemoryerror

  • unabletocreatenativethreads