You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stopping one emulator ends the shared netsimd, which every other emulator's network uses (macOS, Linux) #1690
On macOS (and likely Linux), stopping one emulator can cut the network of every other emulator on the host.
The emulator starts one netsimd per host, and every emulator's network goes through it. On macOS it starts in the first emulator's process group. Simlock kills an emulator by signalling its whole process group (killProcessTree, process.kill(-pid, …) in src/ports/process-tree-kill.ts), so the kill ends netsimd too.
Seen on macOS 26.6, emulator on Apple silicon, Pixel_8_API_35 started in its own process group:
kill -TERM -27540 ended both. #1129 fixed the same bug on Windows (killChildren there kills only emulator.exe and its direct children); there, a second emulator lost its network when the first one's tree was killed.
Expected
Stopping one emulator leaves netsimd, and the network of the other emulators, running on every OS.
Part of #1068 (found during its review), affects macOS and Linux.
Confirmed. src/ports/process-runner.test.ts, "ends a child spawned with killChildren and leaves the process it started running" (POSIX only), on bug/1690-repro. A child spawned with killChildren: true starts one process, as qemu starts netsimd; a SIGKILL kill ends both.
pnpm exec vitest run --project unit src/ports/process-runner.test.ts -t "leaves the process it started running"
AssertionError: expected false to be true
❯ src/ports/process-runner.test.ts:566:41
expect(isAlive(sharedPid ?? 0)).toBe(true);
Root cause
Defect. src/ports/process-tree-kill.ts:115 sends every kill off Windows to the process group (process.kill(-pid, signal)), and windowsKillOf (src/ports/node-process-runner.ts:586) ignores killChildren outside Windows. Off Windows the emulator launcher execs qemu, so the spawned pid is qemu. The issue's ps shows this: qemu leads its own group, and netsimd is its child in that group. The emulator spawns with killChildren (src/drivers/android/emulator.ts:274), but the group kill still reaches netsimd. The symptom appears in every fallback handle.kill("SIGKILL"): a boot that fails (emulator.ts:298), a shutdown that outlives emu kill (emulator.ts:340), and the seed error paths in seeds.ts. A normal emu kill exit sends no signal (isRunning guard).
Simplest fix
Off Windows, a killChildren child is signalled alone. windowsKillOf returns "children" on every OS, killProcessTree sends process.kill(pid) for "children" instead of -pid, and the code: null override in both handles applies on Windows only. Then rewrite the comments in process-runner-types.ts:31-39, emulator.ts:272 and the test's why: at process-runner.test.ts:516.
3 lines in node-process-runner.ts, 1 in process-tree-kill.ts
pnpm exec vitest run --project unit src/ports/process-runner.test.ts src/ports/windows-command.test.ts src/drivers/android
Test Files 43 passed (43) Tests 785 passed | 6 skipped (791)
Alternatives rejected
Kill the group but spare a process named netsimd: brittle, because it matches on a binary name.
Kill the child and its direct children, as on Windows: off Windows netsimd is qemu's direct child.
Risk
On Linux this relies on the launcher exec'ing qemu. Checked on macOS only (the launcher imports _execv, and the issue's ps agrees). If a launcher spawns qemu instead, qemu outlives the kill.
Any other child that qemu starts in its group now outlives a fallback kill. crashpad_handler calls setsid, so the group kill never reached it anyway.
Done: PR #1694 (head 3a63435). Off Windows, a killChildren process is now signalled alone, not its whole process group, so killing one emulator's qemu no longer takes netsimd with it. A fast-lane test in src/ports/process-runner.test.ts proves it with a stand-in child. Review round 1 found one stale test comment (fixed); the fix-check passed. PR is ready.
Not done: the check on real emulators. No slow-lane test starts two emulators, stops one and checks netsimd, so the hardware stage could not run. The gate was not run.
Findings: none open. One review note posted on the PR.
Blocked on: a person verifying on macOS or Linux with two real emulators (stop one; netsimd and the other's network stay up), or a slow-lane case for it. Then remove needs-hardware and run the gate (merge-pr.sh 1694) or merge by hand.
Done: PR #1694 (head 8c6dc4e) is ready, CI is green and the review is complete with no open findings. A new slow-lane case in e2e/slow-android-smoke.test.ts leases two emulators. It freezes the qemu that owns netsimd's process group, so releasing it reaches the SIGKILL fallback, then checks that netsimd and the other emulator's network survive. It passes on this Mac. With the fix reverted it fails, because netsimd dies. needs-hardware is removed.
Not done: the merge. The gate held the PR under the fast track because it has a "Decision taken" comment: a slow-lane case was added instead of parking on review finding R2.
Findings: none open (R1 and R2 fixed).
Blocked on: fast-track: PR #1694 has a "Decision taken" comment. The maintainer merges the PR, or removes fast-track from #1690 and runs merge-pr.sh 1694.
Merged: none
Parked: #1690 — PR #1694 held by the fast track (Decision taken comment); hardware verified
Waiting: none
Decided: #1690 — how to prove the fix on real emulators → a slow-lane case that reaches the SIGKILL fallback (fails without the fix)
Activity
V3RON commentedon Nov 18, 2026
Reproduction
Confirmed.
src/ports/process-runner.test.ts, "ends a child spawned with killChildren and leaves the process it started running" (POSIX only), onbug/1690-repro. A child spawned withkillChildren: truestarts one process, as qemu startsnetsimd; aSIGKILLkill ends both.Root cause
Defect.
src/ports/process-tree-kill.ts:115sends every kill off Windows to the process group (process.kill(-pid, signal)), andwindowsKillOf(src/ports/node-process-runner.ts:586) ignoreskillChildrenoutside Windows. Off Windows theemulatorlauncher execs qemu, so the spawned pid is qemu. The issue'spsshows this: qemu leads its own group, andnetsimdis its child in that group. The emulator spawns withkillChildren(src/drivers/android/emulator.ts:274), but the group kill still reachesnetsimd. The symptom appears in every fallbackhandle.kill("SIGKILL"): a boot that fails (emulator.ts:298), a shutdown that outlivesemu kill(emulator.ts:340), and the seed error paths inseeds.ts. A normalemu killexit sends no signal (isRunningguard).Simplest fix
Off Windows, a
killChildrenchild is signalled alone.windowsKillOfreturns"children"on every OS,killProcessTreesendsprocess.kill(pid)for"children"instead of-pid, and thecode: nulloverride in both handles applies on Windows only. Then rewrite the comments inprocess-runner-types.ts:31-39,emulator.ts:272and the test'swhy:atprocess-runner.test.ts:516.Alternatives rejected
netsimd: brittle, because it matches on a binary name.netsimdis qemu's direct child.Risk
_execv, and the issue'spsagrees). If a launcher spawns qemu instead, qemu outlives the kill.crashpad_handlercallssetsid, so the group kill never reached it anyway.Fast track
Written by an agent.
docs(ports): killProcessTree's comment says a killChildren child is s…
docs(ports): the killChildren exit-code test's comment says the child…
V3RON commentedon Nov 18, 2026
Handoff
Done: PR #1694 (head 3a63435). Off Windows, a
killChildrenprocess is now signalled alone, not its whole process group, so killing one emulator's qemu no longer takesnetsimdwith it. A fast-lane test insrc/ports/process-runner.test.tsproves it with a stand-in child. Review round 1 found one stale test comment (fixed); the fix-check passed. PR is ready.Not done: the check on real emulators. No slow-lane test starts two emulators, stops one and checks
netsimd, so the hardware stage could not run. The gate was not run.Findings: none open. One review note posted on the PR.
Blocked on: a person verifying on macOS or Linux with two real emulators (stop one;
netsimdand the other's network stay up), or a slow-lane case for it. Then removeneeds-hardwareand run the gate (merge-pr.sh 1694) or merge by hand.Written by an agent.
V3RON commentedon Nov 18, 2026
Delivery run
Merged: none
Parked: #1690 — PR #1694 needs-hardware: no slow-lane test runs two real emulators to check
netsimdsurvivesWaiting: none
Decided: none
Written by an agent.
test(android): a slow-lane case proves releasing one emulator leaves …
test(android): the netsimd e2e case reaches the SIGKILL fallback by f…
V3RON commentedon Nov 18, 2026
Handoff
Done: PR #1694 (head 8c6dc4e) is ready, CI is green and the review is complete with no open findings. A new slow-lane case in
e2e/slow-android-smoke.test.tsleases two emulators. It freezes the qemu that ownsnetsimd's process group, so releasing it reaches the SIGKILL fallback, then checks thatnetsimdand the other emulator's network survive. It passes on this Mac. With the fix reverted it fails, becausenetsimddies.needs-hardwareis removed.Not done: the merge. The gate held the PR under the fast track because it has a "Decision taken" comment: a slow-lane case was added instead of parking on review finding R2.
Findings: none open (R1 and R2 fixed).
Blocked on: fast-track: PR #1694 has a "Decision taken" comment. The maintainer merges the PR, or removes
fast-trackfrom #1690 and runsmerge-pr.sh 1694.Written by an agent.
V3RON commentedon Nov 18, 2026
Delivery run
Merged: none
Parked: #1690 — PR #1694 held by the fast track (Decision taken comment); hardware verified
Waiting: none
Decided: #1690 — how to prove the fix on real emulators → a slow-lane case that reaches the SIGKILL fallback (fails without the fix)
Written by an agent.
fix(ports): stopping one emulator leaves the host's netsimd running (c…