Skip to content

SETTING_MAX_SCHEDULED_WRITE_REQUESTS does not work for TLS session #406

Open

Description

@FIXGateway

Describe the bug
When a session is a TLS session, for example, a Bloomberg TLS session, SETTING_MAX_SCHEDULED_WRITE_REQUESTS does not work as expected.
If we set SETTING_MAX_SCHEDULED_WRITE_REQUESTS to be 10 for a TLS session, when we send (very very slowly) total messages more than 10, the session will be disconnected. It seems that for a TLS session, this number is the accumulated FIX messages we could send out after session logon (35=A).

To Reproduce

  1. Setup a TLS FIX session
  2. set SETTING_MAX_SCHEDULED_WRITE_REQUESTS to be 10
  3. Connect and Logon this TLS session (35=A)
  4. Send 11 messages very very slowly
  5. This TLS session is disconnected after 11 messages sent with error message - Disconnecting: Slow consumer

Expected behavior
When set SETTING_MAX_SCHEDULED_WRITE_REQUESTS to be 10 for a TLS session, only if total unsent FIX messages in Write Request Queue is greater than 10, then disconnect the TLS session.

system information:

  • OS: Linux
  • Java version JDK8
  • QFJ Version 2.2.0

Additional context
SETTING_MAX_SCHEDULED_WRITE_REQUESTS is working fine for non-TLS session, when a FIX message is sent out, the Write Request Queue size will decrease correctly. For a TLS session, it seems that Write Request Queue size does not decrease at all, it just keep increasing forever.

Activity

  1. chrjohn commented on Jul 13, 2021

    @chrjohn
    Member
  2. chrjohn commented on Jul 26, 2021

    @chrjohn
    Member
  3. added theissue type on May 14, 2025
  4. the-thing commented on Sep 8, 2026

    @the-thing
    Collaborator

    I have a feeling that it will take quite a while before my mina PR is merged and then released so I might prepare local quickfixj patch soon.

  5. changed the title [-]SETTING_MAX_SCHEDULED_WRITE_REQUESTS does not work for TLS session[/-] [+]`SETTING_MAX_SCHEDULED_WRITE_REQUESTS` does not work for TLS session[/+] on Sep 9, 2026
  6. the-thing commented on Oct 17, 2026

    @the-thing
    Collaborator

    This was patched and released in MINA 2.2.10.

    https://issues.apache.org/jira/browse/DIRMINA-1146
    apache/mina#61

    I should be following this up with a reasonable test soon. There might be more requests leaks, but we shall see.

  7. chrjohn commented on Oct 18, 2026

    @chrjohn
    Member

    @the-thing thank you for fixing that issue. 👍
    I've created #1347 but it seems there is a problem, even a deadlock in one of the tests if I observed correctly. Was just doing it from my mobile so I couldn't check properly. Will check again on Monday.

  8. the-thing commented on Oct 18, 2026

    @the-thing
    Collaborator

    I have seen and it is not looking good initially. Well, we will have to look.

  9. chrjohn commented on Oct 18, 2026

    @chrjohn
    Member

    Copilot said:

    This confirms the deadlock:

    ssl-exec-0 holds SSLHandlerG1.mWriteQueue in forward_writes().Its downstream filterWrite() waits for Socks5LogicHandler.NioProcessor-633 holds Socks5LogicHandler and waits for mWriteQueue.

    The lock added in 2.2.10 around forward_writes() must not span next.filterWrite(). A single-drainer AtomicBoolean should serialize queue draining while dispatching callbacks without holding a monitor.

  10. the-thing commented on Oct 18, 2026

    @the-thing
    Collaborator

    Lets move the discussion to here #1348

  11. the-thing commented on Oct 18, 2026

    @the-thing
    Collaborator

    The lock added in 2.2.10 around forward_writes() must not span next.filterWrite(). A single-drainer AtomicBoolean should serialize queue draining while dispatching callbacks without holding a monitor.

    This doesn't help too much - it is too vague, but failing minimal working example in MINA would help...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions