Stop writeLoop flood after TCP dead-socket write errors#26
Open
Vishesh-Gupta wants to merge 1 commit into
Open
Stop writeLoop flood after TCP dead-socket write errors#26Vishesh-Gupta wants to merge 1 commit into
Vishesh-Gupta wants to merge 1 commit into
Conversation
writeLoop previously logged and kept writing after the first broken pipe, producing thousands of events per disconnect under load. On write failure, log once, close the connection to trigger disconnect, and drain messageOut without further writes so the session send path does not deadlock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
writeLooppreviously logged a write error and kept writing every remaining outbound FIX message to a dead TCP socket. Under load this produced thousands ofwrite: broken pipeevents per disconnect (seen onfixgateway-btgtacceptor in integration-v2).readLooptriggers a clean session disconnect, and drainmessageOutwithout further writes (avoids blocking the session send path / deadlock).Writeand one log event.Notes
v0.9.6(module pathgithub.com/quickfixgo/quickfix) so fixgateway canreplaceagainst this commit without a rawvendor/edit.merge-latest-quickfix(upstream-synced) rather thanmaster(oldgithub.com/alpacahq/quickfixmodule path). Reviewers may prefer rebasing ontomerge-latest-quickfixtip; the behavioral patch is confined toconnection.go.Test plan
go test -run TestWriteLoopStopsWritingAfterBrokenPipe -count=1