Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat can cause IllegalMonitorStateException from inside a synchronized block?
    primarykey
    data
    text
    <p>We hit an extremely surprising exception today. Inside of a synchronized block, we call wait() and it throws <code>IllegalMonitorStateException</code>. What can cause this?</p> <p>This is happening in well-tested open source code: <a href="http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Mux.java?view=markup#l222">http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Mux.java?view=markup#l222</a></p> <p>We eliminated the obvious causes:</p> <ul> <li>are we synchronized on the right variable? Yes, it's <code>muxLock</code></li> <li>is it a mutable variable? No, <code>muxLock</code> is final</li> <li>are we using any weird "-XX:" JVM flags that might affect monitor behavior? No, but we are launching the JVM embedded inside a C++ app via JNI.</li> <li>is this a strange JVM? No, it's Sun's 1.6.0_25 win/x64 JRE</li> <li>is this a known JVM bug? Can't find anything relevant at <a href="http://bugs.sun.com/bugdatabase">http://bugs.sun.com/bugdatabase</a></li> </ul> <p>So, I'm trying to think of more far-fetched explanations.</p> <ul> <li>could an uncaught out-of-memory error cause the monitor state to be screwed up? We're looking at this, but we're seeing no evidence of memory errors yet.</li> </ul> <p><strong>UPDATE:</strong> (based on comment)</p> <p>I've also verified from the stacktrace and breakpoint that the thread is indeed inside the synchronized block when the exception is thrown. It's not the case that some other unrelated code is emitting the exception (unless something is REALLY confusing Eclipse!)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload