Thread: [Quickfix-developers] Socket Error when expecting a Logout message response
Brought to you by:
orenmnero
From: Yoav <yo...@ya...> - 2008-03-12 19:24:58
|
QuickFix version 1.12.4 (C++), Solaris 10 I'm implementing a clean shutdown in my FIX client. When the process is being killed I send Logout message on all my QF Initiator sessions. I see the following problem: Sometimes everything works, meaning: I see the Logout message being sent and the response being received. But sometimes I see the Logout message being sent and immediately I see an error: "(Socket Error: Connection reset by peer.)" 2 comments: 1) The 'peer' in my case is 'stunnel' which is doing port forwarding 2) During the time I kill my FIX process there are incoming messages (MarketDataSnapshotFullRefresh) Any clue will be highly appreciated, Yoav |
From: Shane T. <str...@co...> - 2008-03-12 21:55:57
|
Yoav, You should send a Session.lookupSession(SessionID).logout() to force the logout and wait for a little while (possibly 30 seconds) using a loop similar to this: int ALITTLEWHILE = 30; for (int sec = 1; (sec <= ALITTLEWHILE) && Session.lookupSession(SessionID).isLoggedOn(); sec++) { Thread.Sleep(1000); } initiator.stop(); -- Shane Trotter Connamara Systems, LLC On 3/12/08, Yoav <yo...@ya...> wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > QuickFix version 1.12.4 (C++), Solaris 10 > > I'm implementing a clean shutdown in my FIX client. > When the process is being killed I send Logout message > on all my QF Initiator sessions. > > I see the following problem: > Sometimes everything works, meaning: I see the Logout > message being sent and the response being received. > But sometimes I see the Logout message being sent and > immediately I see an error: > "(Socket Error: Connection reset by peer.)" > > 2 comments: > 1) The 'peer' in my case is 'stunnel' which is doing > port forwarding > 2) During the time I kill my FIX process there are > incoming messages (MarketDataSnapshotFullRefresh) > > Any clue will be highly appreciated, > Yoav > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |
From: Yoav <yo...@ya...> - 2008-03-13 15:48:19
|
Hi Shane and thanks for your reply. What you suggested is more or less what I do and this where I get the problem. When I kill the process I call the lookupSession(), then I call session->logout(). The Logout message is being sent and the Initiator thread is about to read() from the socket. Then *sometimes* the read() returns an error. It's like something happens to the socket (closed?) but I'm not sure what or why. The same problem happens when I use initiator.stop() and not session->logout() Yoav --- Shane Trotter <str...@co...> wrote: > Yoav, > > You should send a > Session.lookupSession(SessionID).logout() to force > the logout and wait for a little while (possibly 30 > seconds) using a > loop similar to this: > > int ALITTLEWHILE = 30; > for (int sec = 1; (sec <= ALITTLEWHILE) && > Session.lookupSession(SessionID).isLoggedOn(); > sec++) > { > Thread.Sleep(1000); > } > > initiator.stop(); > > -- > Shane Trotter > Connamara Systems, LLC > > On 3/12/08, Yoav <yo...@ya...> wrote: > > QuickFIX Documentation: > http://www.quickfixengine.org/quickfix/doc/html/index.html > > QuickFIX Support: > http://www.quickfixengine.org/services.html > > > > QuickFix version 1.12.4 (C++), Solaris 10 > > > > I'm implementing a clean shutdown in my FIX > client. > > When the process is being killed I send Logout > message > > on all my QF Initiator sessions. > > > > I see the following problem: > > Sometimes everything works, meaning: I see the > Logout > > message being sent and the response being > received. > > But sometimes I see the Logout message being sent > and > > immediately I see an error: > > "(Socket Error: Connection reset by peer.)" > > > > 2 comments: > > 1) The 'peer' in my case is 'stunnel' which is > doing > > port forwarding > > 2) During the time I kill my FIX process there > are > > incoming messages (MarketDataSnapshotFullRefresh) > > > > Any clue will be highly appreciated, > > Yoav > > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio > 2008. > > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > Quickfix-developers mailing list > > Qui...@li... > > > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > > > |
From: Shane T. <str...@co...> - 2008-03-13 15:55:50
|
It sounds like the counterparty is disconnecting before it sends the logout response. Could it be a problem on their end? The error in the QuickFIX log (Connection reset by peer) would seem like this is the case. Have you traced the network packets with Wireshark and tcpview to see precisely what is received/happening on the pipe? Also, are you handling the onLogout() callback to detect logouts during connection resets as opposed to onMessage(Logout)? -- Shane Trotter Connamara Systems, LLC On 3/13/08, Yoav <yo...@ya...> wrote: > Hi Shane and thanks for your reply. > What you suggested is more or less what I do and this > where I get the problem. > When I kill the process I call the lookupSession(), > then I call session->logout(). The Logout message is > being sent and the Initiator thread is about to read() > from the socket. Then *sometimes* the read() returns > an error. It's like something happens to the socket > (closed?) but I'm not sure what or why. > > The same problem happens when I use initiator.stop() > and not session->logout() > > > Yoav > > > --- Shane Trotter <str...@co...> wrote: > > > Yoav, > > > > You should send a > > Session.lookupSession(SessionID).logout() to force > > the logout and wait for a little while (possibly 30 > > seconds) using a > > loop similar to this: > > > > int ALITTLEWHILE = 30; > > for (int sec = 1; (sec <= ALITTLEWHILE) && > > Session.lookupSession(SessionID).isLoggedOn(); > > sec++) > > { > > Thread.Sleep(1000); > > } > > > > initiator.stop(); > > > > -- > > Shane Trotter > > Connamara Systems, LLC > > > > On 3/12/08, Yoav <yo...@ya...> wrote: > > > QuickFIX Documentation: > > > http://www.quickfixengine.org/quickfix/doc/html/index.html > > > QuickFIX Support: > > http://www.quickfixengine.org/services.html > > > > > > QuickFix version 1.12.4 (C++), Solaris 10 > > > > > > I'm implementing a clean shutdown in my FIX > > client. > > > When the process is being killed I send Logout > > message > > > on all my QF Initiator sessions. > > > > > > I see the following problem: > > > Sometimes everything works, meaning: I see the > > Logout > > > message being sent and the response being > > received. > > > But sometimes I see the Logout message being sent > > and > > > immediately I see an error: > > > "(Socket Error: Connection reset by peer.)" > > > > > > 2 comments: > > > 1) The 'peer' in my case is 'stunnel' which is > > doing > > > port forwarding > > > 2) During the time I kill my FIX process there > > are > > > incoming messages (MarketDataSnapshotFullRefresh) > > > > > > Any clue will be highly appreciated, > > > Yoav > > > > > > > > > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by: Microsoft > > > Defy all challenges. Microsoft(R) Visual Studio > > 2008. > > > > > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > _______________________________________________ > > > Quickfix-developers mailing list > > > Qui...@li... > > > > > > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > > > > > > > |
From: Yoav <yo...@ya...> - 2008-03-13 16:34:28
|
Hi Shane, The counterparty is my case is a local 'stunnel' (this is where my FIX client connects to and stunnel forwards my messages to the "real" party). I do see in the stunnel logs that the socket was closed but I don't think (though I'm not sure) that it was initiated by either stunnel or the real coutnerparty. Did you ever see some problems with QF related to logging out while receiving incoming messages? Regarding your second question: I'm not sure I understand. What is the proper handling of onLogout() (when I initiated the logout)? (I don't use the message cracker so I don't use the onMessage functions) Thanks! Yoav --- Shane Trotter <str...@co...> wrote: > It sounds like the counterparty is disconnecting > before it sends the > logout response. Could it be a problem on their > end? The error in > the QuickFIX log (Connection reset by peer) would > seem like this is > the case. > > Have you traced the network packets with Wireshark > and tcpview to see > precisely what is received/happening on the pipe? > > Also, are you handling the onLogout() callback to > detect logouts > during connection resets as opposed to > onMessage(Logout)? > > -- > Shane Trotter > Connamara Systems, LLC > > On 3/13/08, Yoav <yo...@ya...> wrote: > > Hi Shane and thanks for your reply. > > What you suggested is more or less what I do and > this > > where I get the problem. > > When I kill the process I call the > lookupSession(), > > then I call session->logout(). The Logout message > is > > being sent and the Initiator thread is about to > read() > > from the socket. Then *sometimes* the read() > returns > > an error. It's like something happens to the > socket > > (closed?) but I'm not sure what or why. > > > > The same problem happens when I use > initiator.stop() > > and not session->logout() > > > > > > Yoav > > > > > > --- Shane Trotter <str...@co...> wrote: > > > > > Yoav, > > > > > > You should send a > > > Session.lookupSession(SessionID).logout() to > force > > > the logout and wait for a little while > (possibly 30 > > > seconds) using a > > > loop similar to this: > > > > > > int ALITTLEWHILE = 30; > > > for (int sec = 1; (sec <= ALITTLEWHILE) && > > > Session.lookupSession(SessionID).isLoggedOn(); > > > sec++) > > > { > > > Thread.Sleep(1000); > > > } > > > > > > initiator.stop(); > > > > > > -- > > > Shane Trotter > > > Connamara Systems, LLC > > > > > > On 3/12/08, Yoav <yo...@ya...> wrote: > > > > QuickFIX Documentation: > > > > > > http://www.quickfixengine.org/quickfix/doc/html/index.html > > > > QuickFIX Support: > > > http://www.quickfixengine.org/services.html > > > > > > > > QuickFix version 1.12.4 (C++), Solaris 10 > > > > > > > > I'm implementing a clean shutdown in my FIX > > > client. > > > > When the process is being killed I send > Logout > > > message > > > > on all my QF Initiator sessions. > > > > > > > > I see the following problem: > > > > Sometimes everything works, meaning: I see > the > > > Logout > > > > message being sent and the response being > > > received. > > > > But sometimes I see the Logout message being > sent > > > and > > > > immediately I see an error: > > > > "(Socket Error: Connection reset by peer.)" > > > > > > > > 2 comments: > > > > 1) The 'peer' in my case is 'stunnel' which > is > > > doing > > > > port forwarding > > > > 2) During the time I kill my FIX process > there > > > are > > > > incoming messages > (MarketDataSnapshotFullRefresh) > > > > > > > > Any clue will be highly appreciated, > > > > Yoav > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > This SF.net email is sponsored by: Microsoft > > > > Defy all challenges. Microsoft(R) Visual > Studio > > > 2008. > > > > > > > > > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > > > _______________________________________________ > > > > Quickfix-developers mailing list > > > > Qui...@li... > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > > > > > > > > > > > > |
From: Shane T. <str...@co...> - 2008-03-13 16:43:27
|
The only problem I have seen is disconnecting before receiving a logout response. The wait loop solved that problem. That said, I have never used QuickFIX through stunnel. I do not believe this is a QuickFIX issue though, as stunnel is disconnecting side. -- Shane Trotter Connamara Systems, LLC On 3/13/08, Yoav <yo...@ya...> wrote: > Hi Shane, > The counterparty is my case is a local 'stunnel' (this > is where my FIX client connects to and stunnel > forwards my messages to the "real" party). > I do see in the stunnel logs that the socket was > closed but I don't think (though I'm not sure) that it > was initiated by either stunnel or the real > coutnerparty. > > Did you ever see some problems with QF related to > logging out while receiving incoming messages? > > Regarding your second question: I'm not sure I > understand. What is the proper handling of onLogout() > (when I initiated the logout)? > (I don't use the message cracker so I don't use the > onMessage functions) > > Thanks! > > Yoav > > --- Shane Trotter <str...@co...> wrote: > > > It sounds like the counterparty is disconnecting > > before it sends the > > logout response. Could it be a problem on their > > end? The error in > > the QuickFIX log (Connection reset by peer) would > > seem like this is > > the case. > > > > Have you traced the network packets with Wireshark > > and tcpview to see > > precisely what is received/happening on the pipe? > > > > Also, are you handling the onLogout() callback to > > detect logouts > > during connection resets as opposed to > > onMessage(Logout)? > > > > -- > > Shane Trotter > > Connamara Systems, LLC > > > > On 3/13/08, Yoav <yo...@ya...> wrote: > > > Hi Shane and thanks for your reply. > > > What you suggested is more or less what I do and > > this > > > where I get the problem. > > > When I kill the process I call the > > lookupSession(), > > > then I call session->logout(). The Logout message > > is > > > being sent and the Initiator thread is about to > > read() > > > from the socket. Then *sometimes* the read() > > returns > > > an error. It's like something happens to the > > socket > > > (closed?) but I'm not sure what or why. > > > > > > The same problem happens when I use > > initiator.stop() > > > and not session->logout() > > > > > > > > > Yoav > > > > > > > > > --- Shane Trotter <str...@co...> wrote: > > > > > > > Yoav, > > > > > > > > You should send a > > > > Session.lookupSession(SessionID).logout() to > > force > > > > the logout and wait for a little while > > (possibly 30 > > > > seconds) using a > > > > loop similar to this: > > > > > > > > int ALITTLEWHILE = 30; > > > > for (int sec = 1; (sec <= ALITTLEWHILE) && > > > > Session.lookupSession(SessionID).isLoggedOn(); > > > > sec++) > > > > { > > > > Thread.Sleep(1000); > > > > } > > > > > > > > initiator.stop(); > > > > > > > > -- > > > > Shane Trotter > > > > Connamara Systems, LLC > > > > > > > > On 3/12/08, Yoav <yo...@ya...> wrote: > > > > > QuickFIX Documentation: > > > > > > > > > > http://www.quickfixengine.org/quickfix/doc/html/index.html > > > > > QuickFIX Support: > > > > http://www.quickfixengine.org/services.html > > > > > > > > > > QuickFix version 1.12.4 (C++), Solaris 10 > > > > > > > > > > I'm implementing a clean shutdown in my FIX > > > > client. > > > > > When the process is being killed I send > > Logout > > > > message > > > > > on all my QF Initiator sessions. > > > > > > > > > > I see the following problem: > > > > > Sometimes everything works, meaning: I see > > the > > > > Logout > > > > > message being sent and the response being > > > > received. > > > > > But sometimes I see the Logout message being > > sent > > > > and > > > > > immediately I see an error: > > > > > "(Socket Error: Connection reset by peer.)" > > > > > > > > > > 2 comments: > > > > > 1) The 'peer' in my case is 'stunnel' which > > is > > > > doing > > > > > port forwarding > > > > > 2) During the time I kill my FIX process > > there > > > > are > > > > > incoming messages > > (MarketDataSnapshotFullRefresh) > > > > > > > > > > Any clue will be highly appreciated, > > > > > Yoav > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > This SF.net email is sponsored by: Microsoft > > > > > Defy all challenges. Microsoft(R) Visual > > Studio > > > > 2008. > > > > > > > > > > > > > > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > > > > > _______________________________________________ > > > > > Quickfix-developers mailing list > > > > > Qui...@li... > > > > > > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > > > > > > > > > > > > > > > > > > > |
From: Parjeet S. <par...@oa...> - 2008-03-13 06:34:44
|
This is a simple question but I need bit of clarifications: I am not sure few scenarios. I have coded to SendMessage in this way: Private Function SendMessageRequest(ByVal intQuoteReqID As Integer) As Boolean strQuoteReqID = CStr(intQuoteReqID) message.setField(New StringField(40, "C")) message.setField(New StringField(167, "FOR")) message.setField(New StringField(131, strQuoteReqID)) message.setField(New StringField(146, "1")) message.setField(New StringField(55, "AUD/USD")) Try Session.sendToTarget(message, "OAKVALE-PRICES-TEST", "BARX-PRICES-TEST") Catch e As SessionNotFound MsgBox(e.Message) End Try At the moment I am hard coding that is the Tag and Description. message.setField (New StringField (40,"C")) - Is there any way I can avoid hard coding and use data dictionary for ordType Tag and description etc. - At the moment I am calling above code from onLogon..........is this correct place to call above function or I have to use toApp call back Public Sub onLogon(ByVal Param As QuickFix.SessionID) Implements QuickFix.Application.onLogon System.Console.WriteLine("Logon: " & Param.GetType.FullName) Dim s As Session = Session.lookupSession(Param) If (s.isLoggedOn = True) Then If (s.receivedLogon = True) Then intQuoteReqID = intQuoteReqID + 1 SendMessageRequest(intQuoteReqID) End If End If |
From: Shane T. <str...@co...> - 2008-03-13 13:10:21
|
Parjeet, Create the message for the exact type you want and use its constructor with QuickFix types. Dim message As QuickFix41.OrderCancelRequest(New OrigClOrdID("123"), New ClOrdID("321"), New Symbol("LNUX"), New Side(Side.BUY)) message.set(new Text("Cancel My Order!")); OrdType is similar, use the QuickFIX namespace: message.setField(new OrdType(OrdType.LIMIT)); -- Shane Trotter Connamara Systems, LLC On 3/13/08, Parjeet Singh <par...@oa...> wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > > This is a simple question but I need bit of clarifications: I am not > sure few scenarios. > > I have coded to SendMessage in this way: > > > Private Function SendMessageRequest(ByVal intQuoteReqID As Integer) As > Boolean > > strQuoteReqID = CStr(intQuoteReqID) > > > message.setField(New StringField(40, "C")) > > message.setField(New StringField(167, "FOR")) > message.setField(New StringField(131, strQuoteReqID)) > message.setField(New StringField(146, "1")) > message.setField(New StringField(55, "AUD/USD")) > > Try > Session.sendToTarget(message, "OAKVALE-PRICES-TEST", > "BARX-PRICES-TEST") > > Catch e As SessionNotFound > MsgBox(e.Message) > End Try > > > At the moment I am hard coding that is the Tag and Description. > message.setField (New StringField (40,"C")) > > - Is there any way I can avoid hard coding and use data dictionary for > ordType Tag and description etc. > > > - At the moment I am calling above code from onLogon..........is this > correct place to call above function or I have to use toApp call back > > Public Sub onLogon(ByVal Param As QuickFix.SessionID) Implements > QuickFix.Application.onLogon > System.Console.WriteLine("Logon: " & Param.GetType.FullName) > > Dim s As Session = Session.lookupSession(Param) > > > If (s.isLoggedOn = True) Then > If (s.receivedLogon = True) Then > intQuoteReqID = intQuoteReqID + 1 > SendMessageRequest(intQuoteReqID) > End If > End If > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |