You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix the rpc stream subscription race that could miss the final wakeup in blocking reads.
Initialize subscription offsets from the current tail so subscribers only receive new items.
Capture the cond channel before releasing the read lock to avoid dropped broadcasts.
Verification
go test -count=20 -race -tags=test ./rpc/stream -run 'TestStream(ReadBlocking|Subscribe)'
go test -race -tags=test ./rpc/stream
stream.go:74: changing offset = -1 to offset = s.lastID() is a silent behavior change. any caller relying on replay-from-beginning semantics will silently stop receiving historical items. please document this in the changelog and confirm no existing Subscribe call sites depend on the old behavior.
no regression tests. the missed-wakeup race fix and the new offset behavior both need test coverage. the pr description describes manual verification steps but those do not prevent future regressions. please add a test that exercises concurrent Add + ReadBlocking under -race to pin the race fix, and a test for the new subscribe-from-tail behavior.
minor: Channel() in cond.go is exported but only used internally by ReadBlocking. unexport it.
The reason will be displayed to describe this comment to others. Learn more.
silent behavior change in Subscribe offset, missing regression tests, unnecessary export of Channel().
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
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.
Description
Fix the rpc stream subscription race that could miss the final wakeup in blocking reads.
Initialize subscription offsets from the current tail so subscribers only receive new items.
Capture the cond channel before releasing the read lock to avoid dropped broadcasts.
Verification
go test -count=20 -race -tags=test ./rpc/stream -run 'TestStream(ReadBlocking|Subscribe)'
go test -race -tags=test ./rpc/stream