[QFJ-211] Race Condition/NPE on Session.disconnect() Created: 13/Jul/07  Updated: 11/Feb/09  Resolved: 27/Jul/07

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.2.1
Fix Version/s: 1.3.0

Type: Bug Priority: Default
Reporter: Toli Kuznets Assignee: Steve Bate
Resolution: Fixed Votes: 0
Labels: None


 Description   

I'm seeing the following show up when i kill the connection to my FIX destination:
<20070713-01:24:51, FIX.4.4:test-quote-asker->test-exchange, event> (Forcibly disconnecting session)
<20070713-01:24:51, FIX.4.4:test-quote-asker->test-exchange, event> (Disconnecting)
<20070713-01:24:51, FIX.4.4:test-quote-asker->test-exchange, event> (Disconnecting)
18:24:51,172 ERROR [SocketConnectorIoProcessor-1.0] mina.initiator.InitiatorIoHandler (AbstractIoHandler.java:77) - protocol handler exception
jjava.lang.NullPointerException
at quickfix.Session.disconnect(Session.java:1369)
at quickfix.mina.AbstractIoHandler.sessionClosed(AbstractIoHandler.java:99)

This happens in Session.disconnect(), where we have the following code:
if (hasResponder()) {
getLog().onEvent("Disconnecting");
NPE>>>> getResponder().disconnect();

both hasResponder() and getResponder() are protected with synchronized(responderSync), but it seems that we have a situation where the responder itself disappears between the call to hasResponder() and when it's being used.

Perhaps we need to put a bigger lock around the whole test/get/use structure?



 Comments   
Comment by Steve Bate [ 27/Jul/07 ]

Modified Session.disconnect to eliminate the race condition.

Generated at Mon Apr 29 09:55:08 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.