Impossible Exception

C

Christian

Hello Folks,

I just encountered one of those impossible Exceptions.. now I would like
to ask if someone has an explanetion how this could happen.
First the stacktrace (Only Top line Semaphore.acqire seems important to me):

java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at org.eclipse.core.internal.jobs.Semaphore.acquire(Semaphore.java:38)
at org.eclipse.core.internal.jobs.JobManager.join(JobManager.java:699)
at org.eclipse.core.internal.jobs.InternalJob.join(InternalJob.java:321)
at org.eclipse.core.runtime.jobs.Job.join(Job.java:384)
at
de.du_hub.uc.gui.transferview.TransfersView.update(TransfersView.java:288)
at java.util.Observable.notifyObservers(Unknown Source)
at uc.ConnectionHandler.notifyObservers(ConnectionHandler.java:350)
....

so and the code of that Semaphore implementation:

public synchronized boolean acquire(long delay) throws
InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
long start = System.currentTimeMillis();
long timeLeft = delay;
while (true) {
if (notifications > 0) {
notifications--;
return true;
}
if (timeLeft <= 0)
return false;
wait(timeLeft); //here is Line 38
timeLeft = start + delay - System.currentTimeMillis();
}
}


Someone got an Idea what can create such an Exception. Not that I would
know a way to reproduce it. Though I am curious.
 
C

Christian

Zig said:
Yeah, that one is a bit wierd. Questions first:

* What OS & version?
* What version of org.eclipse.core.jobs, and associated fragments?
I am afaik using normal eclipse 3.3 to build my rcp-app against.
* Can you reproduce this? No

A few thoughts:

* Avoid starting threads & jobs during OSGi bundle startup. The bundle
classloader isn't fully initialized, and wierdness may ensue.
this occured in the middle of the program
* If you are using PDE, you might ensure that you are not running in the
debugger? While the debugger works most of the time, it does redefine
classes on the fly in the target JVM, thus wierdness occassionally happens.
Thats probably the best explanation till now.
Weirdness introduced by the debugger. I can think of that as much more
possible than random Ram failure.

Thank you!

Christian
 
C

Christian

Lew said:
Crap, I completely screwed up on this one. Sorry. I should have
studied the Javadocs first.

Note to self: Always read the Javadocs. Always read the Javadocs.
Always read the Javadocs.

I was wrong. Your call to 'wait()' does attempt to use the monitor for
'this', so it shouldn't have failed, based on what we see in your post.

Perhaps an SSCCE will help clear things up.
Sry no SSCCE possible.
I doubt I would be able to reproduce this.

Christian
 
S

Stefan Ram

I am Ram, and I do not fail. However, »RAM«, which is
»Random Access Memory«, might fail.
¯ ¯ ¯
I wasn't really offering that as a likely cause.

»Cosmic ray induced computer crashes have occurred and are
expected to increase with frequency as devices (for
example, transistors) decrease in size in chips. This
problem is projected to become a major limiter of computer
reliability in the next decade.«

http://www.newscientist.com/blog/technology/2008/03/do-we-need-cosmic-ray-alerts-for.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top