Commit 7683f88
committed
fix(uffd-tests): release harnessState.mu before blocking on Serve drain
Address review findings from PR #2519:
* rpc_services_test.go: stopServe now snapshots and clears s.stop
under the lock, then drops the lock before calling stop() (which
blocks on <-done). Holding s.mu across the drain blocked every
concurrent RPC handler that takes s.mu, and would deadlock the
upcoming race tests where WaitFaultHeld needs s.mu while a worker
is parked at a barrier waiting for a paired Pause to drain.
* harness_child_test.go: guard the child's rpc conn close with a
sync.Once so the deferred safety-net close (needed for early
returns from rpc.Register) does not double-close after the
explicit close that unblocks server.ServeCodec on the success path.
Audit of the rest of rpc_services_test.go found no other
lock-during-blocking patterns: releaseAllBarriers, Paging.States,
and Barriers.{Install,WaitHeld,Release} already snapshot under the
lock and call out unlocked; Lifecycle.{Bootstrap,Shutdown,Resume}
only do non-blocking work under the lock (channel send via
context.cancel, fdexit.New, goroutine spawn).1 parent d264863 commit 7683f88
2 files changed
Lines changed: 21 additions & 6 deletions
File tree
- packages/orchestrator/pkg/sandbox/uffd/userfaultfd
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
| |||
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
73 | | - | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
79 | 86 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
| |||
0 commit comments