Profile Image
Mwithi

Apparent deadlock in Swing application (unresponsiveness/hang)

The application hangs randomly when accessing the DB several times

 

Related code can be found here https://github.com/informatici/openhospital-core/blob/develop/src/main/java/org/isf/hospital/service/HospitalIoOperations.java#L57

 

The problem is the most of the time it works, no deadlock seems found.

Also, no Exception is thrown at the application level.



Report URL - https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjEvMDIvMTkvLS1hcGktNmE3NjhhOTMtNDMxOC00ZDJiLWE2MWQtZmZmZWRmMWM5M2UyZjFiY2I4YWQtNjQzNi00MDZlLWI4YWItOWI1MzhkMGQ2OTRmLnR4dA==

  • swing

  • deadlock

  • unresponsiveness

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Mwithi!

 

 Primary challenge in troubleshooting these sort of problems is: Capturing thread dumps right when application hangs. Apparently it looks like this thread dump you captured when application has recovered from the problem.

 

 It would be better if you can write a cron job to capture thread dump on a every 5 minute interval. So when problem resurfaces - you can go back and analyze the thread dump that was captured during that problematic time frame. 

Profile Image

Mwithi

Hi Ram, thanks for the answer. I wrote "apparent" deadlock because the application was hung and not responding any more, but I can see that there are not deadlocks detected, so where could it be the problem then?

Profile Image

Ram Lakshmanan

Hello Mwithi! 


a. In order for an application to suffer from deadlock, first of all it should have BLOCKED state threads. In the thread dump you have uploaded there are no threads in BLOCKED state.


b. Besides that once deadlock has happened, threads will not recover. Only way to recover is to restart the application. 


Both are indicating your application is not suffering from deadlock. Also the code you have highlighted doesn't seems to have potential to trigger deadlock. 


What your application might be experiencing is unresponsiveness/hang. In order to diagnose the unresponsiveness/hang, you need to capture thread dumps at right point in time (as mentioned in my earlier comment). If you have challenges in capturing thread dumps at right point in time, you can use yCrash (https://ycrash.io) agent.

Profile Image

Mwithi

Hello Rama!


Sorry again for the misleading title, it was not a deadlock properly called, but an application unresponsiveness/hang (I'm changing the title).


Found out that it could be a common problem when using c3p0 pool with Hibernate, so a connection.close() operation can solve the problem and we are actually testing it in https://github.com/informatici/openhospital-core/pull/334
(source: https://stackoverflow.com/questions/14105932/c3p0-hangs-in-awaitavailable-with-hibernate/14108717#14108717)


Thanks for your advices, anyway as I said, we produced the threads dump after the application hang.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • swing

  • deadlock

  • unresponsiveness