a deadlock while doing the Session.isLoggedOn()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

a deadlock while doing the Session.isLoggedOn()

Alexander Gorbachev
QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/

Hello,
 
My quickfix/j 1.0.5 application runs into a deadlock. I'm using the onLogout() callback to count the sessions that are still logged on. The method Session.disconnect() from where the onLogout() is called is synchronized by the Session instance. Inside the onLogout() I'm calling the sess=Session.lookupSession() followed by the sess.isLoggedOn() for every section that is returned by the SessionSettings.sectionIterator(). The problem arises when there are 2 concurrent onLogout() calls from 2 different Session instances. The session1 thread is calling session2_instance.isLoggedOn() while the session2 thread is calling session1_instance.isLoggedOn(). Since isLoggedOn() is also synchronized by the Session instance, and since both instances are already locked, both threads will be waiting for their locks forever. Can this be fixed/workarrounded?
 
Thank you,
Alexander Gorbachev.
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users