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

Escape send queued when blocked on connection side #615

Merged
merged 3 commits into from Apr 22, 2024

Conversation

AlexandrosKyriakakis
Copy link
Contributor

@AlexandrosKyriakakis AlexandrosKyriakakis commented Jan 30, 2024

Issue

Observations

  1. Very high lock contention on session.sendMutex
  2. Random huge delays, after sending a message out getting the response taking to match time ~5s in some cases
  3. Main session loop is either sending a batch (and blocking until all messages in the batch are sent) or reading just ONE incoming message.

So, if there are many messages in the slice toSend, session from our side is blocked until all the messages are sent.
At the same time, if halfway (when half of the messages in toSend have been sent) the other side cannot accept more messages (maybe cause of a buffer overflow) in order to be unblocked, we need to consume some of the incoming messages, which with the current implementation cannot happen.

Proposed solution

When sending queued messages, if any of the messages cannot be sent, then we escape the toSend loop and leave the rest of the messages for the next session loop.

use default instead of a timer

refactor send queued

In case of Log On messages block until sent
@AlexandrosKyriakakis
Copy link
Contributor Author

@ackleymi any thoughts about this?

@ackleymi ackleymi merged commit 51e2cde into quickfixgo:main Apr 22, 2024
36 of 39 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