Profile Image
Amit Gupta

how I stop this blocking of thread?

There are serverals that are blocked .how do I resolve that.Please help

 

- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
- java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=175 (Compiled frame)
- java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await() @bci=42, line=2039 (Compiled frame)
- java.util.concurrent.LinkedBlockingQueue.take() @bci=29, line=442 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.getTask() @bci=149, line=1074 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=26, line=1134 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=624 (Compiled frame)
- java.lang.Thread.run() @bci=11, line=748 (Compiled frame)

 

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

  • stopblockingofthread

  • concurrencyissue

  • blockedstate

Please Sign In or to post your comment or answer

Profile Image

Mahesh

Hi Amit,

 

As you can see in the stack trace posted in the question description, the thread being parked is from the thread pool related to the blocking queue. Threads that are "parked" coming from pools are simply waiting for a task to be assigned. Also, they really consume 0% CPU so I don't think this should be a problem. sun.misc.Unsafe.park(...) is basically like Thread.wait, but it uses os code, so it is not exposed to us.

 

It is possible though that you have a concurrency issue making it so your queue is blocking itself forever.

Profile Image

Ram Lakshmanan

Hello Amit!

 

 Looks like you captured the application once it has become very sick. You should have used '-F' (i.e. Force) option to capture the thread dump. When you use the '-F' option, all threads will be showing up only in two states: 

 

1. BLOCKED

2. NATIVE

 

 You might want to capture thread dump before it becomes very sick. 

 

 Leaving that point aside, still I could see two issues in your application:
 
 a. 636 threads are in BLOCKED state that are originating from 'java.util.concurrent.ThreadPoolExecutor'
 
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
- java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=175 (Compiled frame)
- java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await() @bci=42, line=2039 (Compiled frame)
- java.util.concurrent.LinkedBlockingQueue.take() @bci=29, line=442 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.getTask() @bci=149, line=1074 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=26, line=1134 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=624 (Compiled frame)
- java.lang.Thread.run() @bci=11, line=748 (Compiled frame)


 b. 146 threads are in BLOCKED state that are originating from 'java.util.concurrent.ScheduledThreadPoolExecutor'
 
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
- java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=175 (Compiled frame)
- java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await() @bci=42, line=2039 (Compiled frame)
- java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take() @bci=100, line=1088 (Compiled frame)
- java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take() @bci=1, line=809 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.getTask() @bci=149, line=1074 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=26, line=1134 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=624 (Compiled frame)
- java.lang.Thread.run() @bci=11, line=748 (Compiled frame)

 

Primary reason for this is: There are way too many threads in the pool that then the demand for the work load. You might have to configure lower value to the min thread pool size.

Got something else on mind? Post Your Question

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

  • concurrencyissue

  • blockedstate