Discussion:
[Quickfix-users] Problem logging in - Socket Error: Connection reset by peer
Kimpton, C (Chris)
2005-08-04 06:15:15 UTC
Permalink
<<FixProxyWithBusyOption.java>> Hi,

Sorry for the attachment - but hopefully it will help.

I am trying to write a simple FIX proxy type process - so that I can
simulate a busy response.

The attached code uses quickfix to either accept or initiate connections
- the aim being to do both at once so that it proxy requests, but at
the moment, I am having problems getting the acceptor to accept logon
requests. It starts a connection, but fails to logon. Both processes
are running on the same machine, but I have turned CheckLatency off,
just in case.

This is probably a very basic error - but I just can't see it...


All I see in the acceptor log is:


Fix Proxy - with Busy Option - STARTED
#### FixApplication.onCreate (***@ece65)
<20050804-07:03:16, FIX.4.2:RabobankTest->FixGateway, event>
(Created session)



In the initiator log, I see this:

<20050804-08:03:46, FIX.4.2:RabobankTest->FixGateway, event>
(Connecting to 172.17.23.38 on port 31155)
<20050804-08:03:46, FIX.4.2:RabobankTest->FixGateway, event>
(Connection succeeded)
#### FixApplication.toAdmin (***@ece65)
<20050804-08:03:46, FIX.4.2:RabobankTest->FixGateway, outgoing>

(8=FIX.4.2?9=81?35=A?34=711?49=RabobankTest?52=20050804-08:03:46.642?56=
FixGateway?98=0?108=3000?10=130?)
<20050804-08:03:46, FIX.4.2:RabobankTest->FixGateway, event>
(Initiated logon request)
<20050804-08:03:46, FIX.4.2:RabobankTest->FixGateway, event>
(Socket Error: Connection reset by peer.)
<20050804-08:03:46, FIX.4.2:RabobankTest->FixGateway, event>
(Disconnecting)
#### FixApplication.onLogout (***@ece65)


Many Thanks for any help,
Chris

_____________________________________________________________

This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat.
_____________________________________________________________
Joerg Thoennes
2005-08-04 06:55:16 UTC
Permalink
Hi Chris,
Post by Kimpton, C (Chris)
I am trying to write a simple FIX proxy type process - so that I can
simulate a busy response.
Just curious: What do you mean by busy response?
Post by Kimpton, C (Chris)
The attached code uses quickfix to either accept or initiate connections
- the aim being to do both at once so that it proxy requests, but at
the moment, I am having problems getting the acceptor to accept logon
requests. It starts a connection, but fails to logon. Both processes
are running on the same machine, but I have turned CheckLatency off,
just in case.
This is probably a very basic error - but I just can't see it...
[...]
<20050804-07:03:16, FIX.4.2:RabobankTest->FixGateway, event>
[...]
<20050804-08:03:46, FIX.4.2:RabobankTest->FixGateway, event>
Both sides connect as RabobankTest to FixGateway. This does not match. It should look like

Acceptor: <20050804-07:03:16, FIX.4.2:RabobankTest->FixGateway, event>
Initiator: <20050804-08:03:46, FIX.4.2:FixGateway->RabobankTest, event>

If you look at the fix-in.cfg and fix-out.cfg, both contain

SenderCompID=RabobankTest
TargetCompID=FixGateway

In one of the both configs, this should be

SenderCompID=FixGateway
TargetCompID=RabobankTest

Some other remarks:

Why do you use:

ResetOnDisconnect=Y
ResetOnLogout=Y

And you could use the isLoggedOn() method of the session instead of using a _loggedOn
variable. This variable is not thread-safe, ie the JVM spec does not guarantee that
another thread sees the actual value of _loggedOn. Please use

private synchronized boolean getLoggedOn() { return this._loggedOn; }
private synchronized setLoggedOn( final boolean loggedOn } { this._loggedOn = loggedOn; }

Do you know that you can send message to a FIX session even if it is not logged on? I.e.
this check is not necessary, except you explitely want that behaviour.

Cheers, Jörg
--
Joerg Thoennes
http://macd.com
Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH
Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen
Kimpton, C (Chris)
2005-08-04 07:13:17 UTC
Permalink
Hi Jörg,

Many thanks - that was it - I did not reverse the sender/target ids.



On your other points.
Post by Joerg Thoennes
Post by Kimpton, C (Chris)
I am trying to write a simple FIX proxy type process - so that I can
simulate a busy response.
Just curious: What do you mean by busy response?
When "busy" is turned on (not coded yet) I want to reject the messages using FIX reject messages, until the I turn it off again. The initiator should then retry until it does not get this kind of response. This is tool for testing a specific problem only.
Post by Joerg Thoennes
ResetOnDisconnect=Y
ResetOnLogout=Y
Just clutching at straws to try and get my basic problem solved - the socket error. I will probably remove these when they start causing more problems ;-)
Post by Joerg Thoennes
And you could use the isLoggedOn() method of the session instead of using a _loggedOn variable. This variable is not thread-
safe, ie the JVM spec does not guarantee that another thread sees the actual value of _loggedOn. Please use
private synchronized boolean getLoggedOn() { return this._loggedOn; }
private synchronized setLoggedOn( final boolean loggedOn } { this._loggedOn = loggedOn; }
Do you know that you can send message to a FIX session even if it is not logged on? I.e.
this check is not necessary, except you explitely want that behaviour.
It was more to cut down on superfluous messages being passed around - but I might review that when I actually get it doing the proxying... As to the JVM spec side of things, I did not know that, but I will bear that in mind.

Thanks again,
Chris
_____________________________________________________________

This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat.
_____________________________________________________________
Joerg Thoennes
2005-08-04 07:27:11 UTC
Permalink
Post by Kimpton, C (Chris)
As to the JVM spec side of things, I did not know that, but I will bear that in mind.
Have a look here to get some introduction into the Java Memory Model:

http://www.cs.umd.edu/~pugh/java/memoryModel/JavaOneBOF/

These issues are addressed by Java 1.5

For the more curious people:

http://www.cs.umd.edu/~pugh/java/memoryModel/

Cheers, Jörg
--
Joerg Thoennes
http://macd.com
Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH
Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen
Loading...