fix: gok logs: fix races happening in CI - #103
Merged
Merged
Conversation
…anic The eventsource library's background goroutine may still be sending on the Events/Errors channels when Close() is called, causing a panic. Context cancellation already aborts the HTTP request, which makes the library goroutine exit on its own. This fixes TestGokRun failing in CI with: panic: send on closed channel
eventsource.SubscribeWith mutates the passed http.Client's CheckRedirect field. Since streamLog is called concurrently for stdout and stderr, this is a data race. Clone the client before passing it to the library. Add TestStreamLogConcurrentCancel to exercise both the concurrent client usage and context cancellation under the race detector.
damdo
marked this pull request as ready for review
May 28, 2026 17:49
Contributor
|
Thanks! |
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.
This PR fixes a couple of flakes I've encountered during CI runs on this repo:
gok logs: don't call stream.Close() to avoid send-on-closed-channel panic
2101e43
The eventsource library's background goroutine may still be sending on
the Events/Errors channels when Close() is called, causing a panic.
Context cancellation already aborts the HTTP request, which makes the
library goroutine exit on its own.
gok logs: fix data race on http.Client.CheckRedirect
6d2603f
eventsource.SubscribeWith mutates the passed http.Client's
CheckRedirect field. Since streamLog is called concurrently for
stdout and stderr, this is a data race. Clone the client before
passing it to the library.
Add TestStreamLogConcurrentCancel to exercise both the concurrent
client usage and context cancellation under the race detector.