real-logic / artio

Artio - Resilient High-Performance FIX and FIXP Gateway
Apache License 2.0
300 stars 121 forks source link

FIXEngine can take over sessions even when using SOLE_LIBRARY mode or using SessionProxy #502

Open pcdv opened 8 months ago

pcdv commented 8 months ago

In case of library timeout, the Framer acquires the sessions of the library. Once acquired, messages can be sent to the session without going through the library (e.g. Heartbeat or Logout).

When using SOLE_LIBRARY mode, this seems counter-intuitive:

Even without SOLE_LIBRARY, this is problematic when one needs to control the sending of FIX messages through a SessionProxy (known only at library level): it the library times out, messages will be sent circumventing the SessionProxy.

The problem with this is that it becomes impossible to keep track of sent MsgSeqNum in a clustered solution.

A configuration parameter should allow to prevent the engine from autonomously sending messages to sessions.

pcdv commented 8 months ago

Reading #361 (Don't revert ownership of offline sessions to the Engine in Sole Library mode) seems to indicate that this is a bug.

haoyang1994 commented 8 months ago

I have the same confusion. The existing tcp connection will not be released when the sole library is disconnected, but will be taken over by the Gateway Library. As a result, SessionProxy cannot track all outbound messages. I'm wondering whether to put Engine and Library in the same process and release the engine's tcp connection in the library disconnect callback.

pcdv commented 8 months ago

FYI this is what I do: several processes embed their own engine + library, even though that is not the original philosophy behind artio (and is heavier in terms of processing).

Nevertheless, disconnections between engine and library due to timeout can still happen. I've seen it in two scenarios:

I'm wondering whether I should take care of closing all sessions from the library before shutting down the engine, to avoid the risk of having sending uncontrolled outbound messages because of this issue.

pcdv commented 7 months ago

In issue #503, another example of message (SequenceReset) sent without going through SessionProxy.