Commit a00207c
fix: data race between WorkerPool.Start and Stop (#320)
## Summary
- Fix data race between `WorkerPool.Start` and `Stop` when a signal
fires during daemon startup
- `wg.Add` in `Start()` was racing with `wg.Wait` in `Stop()`, detected
by `-race` in `TestDaemonSignalCleanup` on macOS CI
- Add a `readyCh` channel that `Start` closes after `wg.Add`, so `Stop`
can synchronize before calling `wg.Wait`
## Test plan
- [x] `go test -race ./internal/daemon/... -count=1` passes
- [x] `go test -race ./cmd/roborev/... -tags integration -run
TestDaemonSignalCleanup -count=5` passes (5/5, no races)
- [x] `TestServerStop_StopsCIPoller` still works (Stop without Start)
- [x] Full `go test ./...` passes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 7f78f69 commit a00207c
1 file changed
+32
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
78 | 88 | | |
79 | 89 | | |
80 | | - | |
| 90 | + | |
| 91 | + | |
81 | 92 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
86 | 106 | | |
87 | 107 | | |
88 | 108 | | |
| |||
0 commit comments