[QFJ-638] SocketSynchronousWrites=Y Hangs Threads on Session responderSync Created: 03/Oct/11 Updated: 02/Apr/15 Resolved: 13/Feb/14 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 1.5.1 |
Fix Version/s: | 1.6.0 |
Type: | Bug | Priority: | Default |
Reporter: | James Olsen | Assignee: | Christoph John |
Resolution: | Fixed | Votes: | 0 |
Labels: | None |
Attachments: | QFJ-638.patch | ||||||||
Issue Links: |
|
Description |
As first noted by Parwinder Sekhon in private boolean send(String messageString) { return getResponder().send(messageString); Slow consumers do exist in the real world. We therefore sometimes have to use SocketSynchronousWrites=Y in order to avoid memory leaks due to all the WriteFuture objects that are generated. The problem with the current locking is that the background thread that handles heartbeats and forces logouts etc can get stuck waiting for one of these slow consumers. This means that the Session will not be logged out even if it has missed many heartbeats. Even worse, the same background thread is used for other Sessions on the same Connector so they are also impacted even if they are not synchronous. Changing the code as follows resolves these issues. private boolean send(String messageString) { if (responder == null) { getLog().onEvent("No responder, not sending message: " + messageString); return false; } return responder.send(messageString); The message sequence number locking used in the sendRaw method seems sufficient to coordinate any multi-threaded message senders given that the above change otherwise opens a hole. The use of a ReentrantLock as discussed in |
Comments |
Comment by James Olsen [ 03/Oct/11 ] |
Patch attached. |