Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce SocketConnectTimeout configuration option #638

Merged
merged 8 commits into from
Jun 29, 2024

Conversation

AndreyNudko
Copy link
Contributor

Stopping MINA connector can take up to a minute if there is in-flight TCP handshake which can't complete due to firewall cutting the traffic. What happens in this case is NioSocketConnector background task keeps running until connection timeout expires even after dispose() was called, and default timeout is a minute (see o.a.m.c.s.AbstractIoConnector). This behaviour is surprising: intuitively you expect closing the session to block no more than logon/logout timeout; but currently even with stricter than default settings it's still not safe to do this from a time-sensitive thread.

This patch makes connection timeout configurable on QuickFIX side - which may be a bit of a workaround, but seems like a generally useful socket option. Default value for now matches MINA for backward compatibility. However, it can potentially be lowered to something like 5 seconds (half of the default LogonTimeout), and then reconnection logic would still ensure the session is eventually established.

Stopping MINA connector can take up to a minute if there is in-flight TCP handshake which can't complete due to firewall cutting the traffic. What happens in this case is NioSocketConnector background task keeps running until connection timeout expires even after dispose() was called, and default timeout is a minute (see o.a.m.c.s.AbstractIoConnector). This behaviour is surprising: intuitively you expect closing the session to block no more than logon/logout timeout; but currently even with stricter than default settings it's still not safe to do this from a time-sensitive thread.

This patch makes connection timeout configurable on QuickFIX side - which may be a bit of a workaround, but seems like a generally useful socket option.
Default value for now matches MINA for backward compatibility. However, it can potentially be lowered to something like 5 seconds (half of the default LogonTimeout), and then reconnection logic would still ensure the session is eventually established.
@chrjohn chrjohn added this to the QFJ 3.0.0 milestone May 30, 2023
@chrjohn
Copy link
Member

chrjohn commented May 30, 2023

Hi @AndreyNudko , thanks for the PR. This is definitely useful.

@chrjohn chrjohn changed the title Introduce SocketConnectTimeout configuration option Introduce SocketConnectTimeout configuration option May 30, 2023
@chrjohn chrjohn merged commit 940e568 into quickfix-j:master Jun 29, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants