[codex major] Per-user notify SSE leaks one goroutine per disconnected stream #73
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#73
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
[codex major] Per-user notify SSE leaks one goroutine per disconnected stream
internal/notify/stream.go:252ranges overs.ka.C;close()(:297) only callsTicker.Stop(). Stopping a ticker does not close its channel, so the goroutine blocks forever after the handler'sdefer s.close()(internal/notify/http.go:169). Violates the context-exit rule (every goroutine exits via context).Fix
Make stream teardown actually terminate the keepalive goroutine (close a done channel / context-cancel the range / stop ranging on close — pick the shape matching the codebase's channel rule: sender owns and closes). Regression test proving goroutine exit after handler close (leak check via runtime.NumGoroutine orDone-channel assertion). Coverage gate holds.
Acceptance criteria
-race.Fixed by PR #82 (#82): sender-owned done channel + request-context select replaces the range over ka.C in internal/notify/stream.go; same latent shape fixed in sibling internal/api/sse.go. Regression tests fail pre-fix (5 leaked goroutines) and pass post-fix; notify coverage 97.2%, -race green.
Review of PR #82 (fix/issue-73, commit
f2ac4d1) — verified in scratch worktree /tmp/wt73, main worktree untouched.DONE-CHANNEL LIFECYCLE — PASS
KEEPALIVE LOOP / STUCK-WRITE (omp minor #9) — PASS
SIBLING-FIX SAFETY (task streams) — PASS
REGRESSION TESTS — PASS, GENUINE
GATES
MERGE RECOMMENDATION: ready to merge (no fixes pushed — nothing to fix).
Fixed by PR #82 (review: exactly-once close + write deadlines verified, negative controls genuine; 97.2%/95.5% coverage), merged. Closing.