Conversation
… hang Ferry.Run() launches BinlogWriter.Run() and BinlogStreamer.Run() in concurrent goroutines (ferry.go:733-745). Previously, the event buffer channel was created inside BinlogWriter.Run(), so if the BinlogStreamer received a row event and called BufferBinlogEvents() before the writer goroutine was scheduled, the send would block forever on a nil channel, hanging the test (observed as TestUpdateBinlogSelectCopy timing out after 10 minutes with goroutine state "chan send (nil chan)"). Introduce BinlogWriter.Initialize() — mirroring the existing pattern on BatchWriter — that allocates the channel and logger eagerly. Call it from Ferry.NewBinlogWriter() so the writer is ready for buffering before any goroutine starts. Add a nil-channel guard in Run() as a defensive fallback for callers that construct BinlogWriter directly. Add TestBinlogWriterBufferBinlogEventsBeforeRun to give deterministic, sub-second coverage of the race without relying on the slow integration test timeout.
austenLacy
approved these changes
Apr 15, 2026
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.
Ferry.Run()launchesBinlogWriter.Run()andBinlogStreamer.Run()in concurrent goroutines (ferry.go:733-745). Previously, the event buffer channel was created insideBinlogWriter.Run(), so if theBinlogStreamerreceived a row event and calledBufferBinlogEvents()before the writer goroutine was scheduled, the send would block forever on anilchannel, hanging the test (observed as TestUpdateBinlogSelectCopytiming out after 10 minutes with goroutine state "chan send (nil chan)").Introduce
BinlogWriter.Initialize()— mirroring the existing pattern on BatchWriter — that allocates the channel and logger eagerly. Call it fromFerry.NewBinlogWriter()so the writer is ready for buffering before any goroutine starts. Add a nil-channel guard inRun()as a defensive fallback for callers that constructBinlogWriterdirectly.Add
TestBinlogWriterBufferBinlogEventsBeforeRunto give deterministic, sub-second coverage of the race without relying on the slow integration test timeout.