We have an application that works fine most of the time, but every now and then we get a bug. We are using the java observable library. During debugging, I have noticed the issue seems to lie with the observable method setChanged()
. When it is being executed, it seems to cause the main method to stop executing. This causes everything defined after that method to not be called either.
Example
public abstract class SomeClassName extends Observable {
public void someMethod() {
... //some code executed
setChanged(); //Execution of this makes main method (someMethod()) stop once this is reached
someMethod(); //This and everything below will no longer be executed
...
}
}
Most of the time there is no issue and everything works fine as expected. But every now an then we get the issue as shown above. It seems to halt that method entirely in its track. The rest of the application is still fine. There are no errors in the log or anything to work with. Anyone have any idea what the possible issue might be here?
As Erickson suggested, creating a thread dump led to the realisation that a thread deadlock was occuring.