Commit bbdd0fb
fix: data races in NBD path_direct and PostProcessor test on ARM64
- path_direct.go: capture deviceIndex before goroutine closure. The
outer for-loop is not a range loop, so Go 1.22+ loop variable fix
doesn't apply — deviceIndex is reassigned on each retry iteration.
- postprocessor_test.go: use sync.Mutex-wrapped buffer instead of bare
bytes.Buffer. The PostProcessor goroutine and test goroutine write
to the buffer concurrently.
Both races were exposed by running tests with -race on ARM64 (weaker
memory model makes races more likely to manifest).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4f66f81 commit bbdd0fb
2 files changed
Lines changed: 33 additions & 5 deletions
File tree
- packages/orchestrator/pkg
- sandbox/nbd
- template/build/writer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | 130 | | |
127 | 131 | | |
128 | | - | |
| 132 | + | |
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
| |||
Lines changed: 27 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
16 | 40 | | |
17 | 41 | | |
18 | 42 | | |
19 | 43 | | |
20 | 44 | | |
21 | 45 | | |
22 | | - | |
| 46 | + | |
23 | 47 | | |
24 | 48 | | |
25 | 49 | | |
| |||
29 | 53 | | |
30 | 54 | | |
31 | 55 | | |
32 | | - | |
| 56 | + | |
33 | 57 | | |
34 | 58 | | |
35 | 59 | | |
| |||
0 commit comments