0

I'm very much new in the world of java. Recently I faced a problem in which a java application hang due to some issue. When I make a thread dump & I found that this particular thread making hundred thousands of blocked count.

"Thread-1" #12 daemon prio=5 os_prio=0 tid=0x0000000018392800 nid=0x2de0 waiting on condition [0x0000000018ece000]
   java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
   - parking to wait for  <0x00000000a1da8db8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
  at java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:492)
  at com.sun.glass.ui.InvokeLaterDispatcher.run(InvokeLaterDispatcher.java:108)

Locked ownable synchronizers:
- None

& after sometimes the application hang & the thread changes to -

"Thread-1" #12 daemon prio=5 os_prio=0 tid=0x0000000018392800 nid=0x2de0 in Object.wait() [0x0000000018ece000]
  java.lang.Thread.State: WAITING (on object monitor)
  at java.lang.Object.wait(Native Method)
  at java.lang.Object.wait(Object.java:502)
  at com.sun.glass.ui.InvokeLaterDispatcher.run(InvokeLaterDispatcher.java:126)
- locked <0x00000000a1d65960> (a java.lang.StringBuilder)

 Locked ownable synchronizers:
- None

As it's a compiled jar file & I don't know every aspects of java to search for this particulater thread. Is it possible to make an external class file to stop or kill this thread of execution to stop application hang.

sks15
  • 13
  • 9
  • The only thing you can safely do is to interrupt the other thread, and hope that it's a good enough citizen to handle it appropriately. – Andy Turner Jul 03 '18 at 18:28
  • Can you please share how can I put the interrupt command when I don't know from which class the thread is generated? – sks15 Jul 03 '18 at 20:34
  • You can get all the threads [as described here](https://stackoverflow.com/q/1323408/3788176). Work out which thread you want, then call `interrupt()` on it. – Andy Turner Jul 03 '18 at 21:47
  • Can you please help me write the code for this particular case. I still haven't clear idea how can I do that. – sks15 Jul 04 '18 at 09:16
  • 1
    Without code we can't tell if this has anything to do with your problem or not. As far as I know, the `InvokeLaterDispatcher` is regularly blocked in the location shown in the first trace, as that means it currently has nothing to do (there is nothing waiting in its task queue). The second is probably related to the way it handles 'invokeLater' tasks as well. – Mark Rotteveel Jul 04 '18 at 12:32

0 Answers0