Infinite loop in EventQueue.isDispatchThread() Infinite loop in EventQueue.isDispatchThread() multithreading multithreading

Infinite loop in EventQueue.isDispatchThread()


Is there any possibility that push(EventQueue newEventQueue) is called by your application program and that pushes the same eventQueue? If yes, then, this and its nextQueue will be same objects and they will be running in an endless loop consuming CPU to 100%.

From the stack trace its evident that at least one thread is running. So its not a question of DEADLOCK.

From the 100% CPU consumption hint and its state as RUNNABLE, its evident its doing an infinite loop.

The code can go into infinite loop if and only if the nextQueue has a value that's already in the chain (or this). It could very well be an application problem. Thanks.


Your problem is a deadlock problem(see wikipeida).

Deadlock situation hereAs you can see above, your two EventQueues (here R1 and R2) are in a deadlock situation - each of them has claimed one resource and cannot run further while the other one did claim the other resource. Both are waiting for each other endless.

You can solve this problem with different approaches:

Try to change the library, you're right that a library shouldn't try to do awt stuff if it is not a library closely related to awt. Thereare many libraries on platforms like github, I'm quite sure you find another library to replace your one which causes the error.

If you are able to edit your code to add monitoring you are preventing any deadlocks, too.

synchronized(lock){EventQueue next = eq.nextQueue;while (next != null) {    eq = next;    next = eq.nextQueue;}lock.notifyAll();}