pkg/driver/qemu: eliminate race condition and send on closed channel in qWaitCh #5856
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 218 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.322
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5856"
general
weight: 0.35
AkihiroSuda
What This PR Changes
In
LimaQemuDriver.Start, two goroutines concurrently wrote tol.qWaitCh(theqCmd.Wait()goroutine that closedl.qWaitChand theusernetConfigureDrivergoroutine). An early QEMU exit closedl.qWaitChwhile the usernet goroutine could still send on it (panic: send on closed channel), or vice versa.This PR coordinates
qWaitErrChandusernetErrChthrough a singlecoordinateQEMUWaitgoroutine that cancels, joins errors, and closesl.qWaitCh, and addsTestCoordinateQEMUWaitNoRaceOrPanicinpkg/driver/qemu/qemu_test.go.Linked Issue (Required in most cases)
N/A
How I Tested This
Environment: Linux Mint 22.3 (
Linux 7.0.0-43-generic,x86_64), QEMU8.2.2, Go1.26.4(go1.26.11),golangci-lint 2.15.0, commita263af26vs base1c12d399:<img width="914" height="274" alt="pr5856_before_after" src="https://github.com/user-attachments/assets/a1f9d4aa-aa43-4ddf-be48-5e78b29ad54c" />
Not tested locally: macOS QEMU / Windows QEMU host runs.
AI Usage
Assisted-by: Antigravity