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
simlock adb disconnect drops every leased emulator on Simlock's adb server #1168
The virtual passthrough refuses kill-server because "it would detach every leased emulator at once", but passes disconnect with no address through to Simlock's shared server. adb answers that by kicking every emulator transport, since emulators are local transports:
src/drivers/android/index.ts:418 "disconnect" is on NO_DEVICE_SUBCOMMANDS, so no -s is added
src/drivers/android/index.ts:829 only kill-server, three emu sequences and scope flags are refused
adb (packages/modules/adb main) adb.cpp: host:disconnect: with an empty address -> kick_all_tcp_devices()
adb transport.cpp kick_all_tcp_devices: kicks every t->IsTcpDevice(), and IsTcpDevice() is type == kTransportLocal, which emulator transports are
So one holder's simlock adb disconnect drops every other lease's emulator for about a second, and their adb reverse/forward rules go with it. The physical handler already refuses disconnect (physical-handler.ts:36).
Defect, confirmed. One more case than the issue lists: disconnect <serial> kicks the emulator it names, and nothing checks that serial. Branch bug/1168-repro, src/drivers/android/index.test.ts: "refuses adb disconnect with or without an address, on the local CLI and through device.exec". The test tries disconnect, -s emulator-5554 disconnect and disconnect emulator-5556, each from the local CLI and from device.exec.
pnpm exec vitest run --project unit src/drivers/android/index.test.ts -t "refuses adb disconnect"
AssertionError: promise resolved "{ args: [ '-P', '5038', 'disconnect' ], … }" instead of rejecting
What adb does with it (adb main source, read, not run):
adb.cpp:1443 empty address -> kick_all_tcp_devices()
adb.cpp:1450 otherwise find_transport(address) -> kick_transport(t)
transport.h:341 IsTcpDevice() is type == kTransportLocal
transport.cpp:1505 every socket transport is kTransportLocal
transport_emulator.cpp:159 emulator reconnect callback: ReconnectResult::Abort
Correction to the issue: the drop may last longer than "about a second". A kicked emulator does not reconnect. With ADB_EMU=0, only Simlock announces it again (index.ts:2011, during a readiness wait, or at daemon start). Not measured on hardware.
Root cause
src/drivers/android/index.ts:830. #assertProxyable refuses only kill-server (REFUSED_ADB_VERB, :306), the three emu sequences and scope flags. disconnect is on NO_DEVICE_SUBCOMMANDS (:418), so no -s is added and nothing refuses it. Simlock's shared server runs it and detaches other leases' emulators. physical-handler.ts:36 already refuses it.
Simplest fix
Refuse disconnect when it is the subcommand (found through walkGlobals, as isBareShell does), with a message that starts Refusing `simlock adb disconnect` . Add a row to the refusal table in working-with-a-device.mdx and to cli.mdx:189.
Alternatives rejected
Refuse only the bare form: disconnect emulator-5556 still kicks another lease's emulator.
args.includes("disconnect"): it would also refuse shell echo disconnect.
Add disconnect <own serial>: reconnecting needs a re-announce, so the lease would lose its own emulator.
Risk
Refuse it only in subcommand position. Do not refuse it when it is an operand.
Update NO_DEVICE_SUBCOMMANDS and ADR 0047 §1, which lists disconnect, if the fix removes it there.
The maintainer agreed to the triage report's simplest fix: refuse disconnect as the adb subcommand (with or without an address) on the local CLI and through device.exec, so shell echo disconnect still works, and update the refusal tables in working-with-a-device.mdx and cli.mdx. The failing test on bug/1168-repro (6738389) is the starting point.
Activity
V3RON commentedon Nov 1, 2026
Reproduction
Defect, confirmed. One more case than the issue lists:
disconnect <serial>kicks the emulator it names, and nothing checks that serial. Branchbug/1168-repro,src/drivers/android/index.test.ts: "refuses adb disconnect with or without an address, on the local CLI and through device.exec". The test triesdisconnect,-s emulator-5554 disconnectanddisconnect emulator-5556, each from the local CLI and fromdevice.exec.What adb does with it (adb main source, read, not run):
Correction to the issue: the drop may last longer than "about a second". A kicked emulator does not reconnect. With
ADB_EMU=0, only Simlock announces it again (index.ts:2011, during a readiness wait, or at daemon start). Not measured on hardware.Root cause
src/drivers/android/index.ts:830.#assertProxyablerefuses onlykill-server(REFUSED_ADB_VERB,:306), the threeemusequences and scope flags.disconnectis onNO_DEVICE_SUBCOMMANDS(:418), so no-sis added and nothing refuses it. Simlock's shared server runs it and detaches other leases' emulators.physical-handler.ts:36already refuses it.Simplest fix
Refuse
disconnectwhen it is the subcommand (found throughwalkGlobals, asisBareShelldoes), with a message that startsRefusing `simlock adb disconnect`. Add a row to the refusal table inworking-with-a-device.mdxand tocli.mdx:189.Alternatives rejected
disconnect emulator-5556still kicks another lease's emulator.args.includes("disconnect"): it would also refuseshell echo disconnect.disconnect <own serial>: reconnecting needs a re-announce, so the lease would lose its own emulator.Risk
NO_DEVICE_SUBCOMMANDSand ADR 0047 §1, which listsdisconnect, if the fix removes it there.Written by an agent.
V3RON commentedon Nov 1, 2026
Agreed fix
The maintainer agreed to the triage report's simplest fix: refuse
disconnectas the adb subcommand (with or without an address) on the local CLI and throughdevice.exec, soshell echo disconnectstill works, and update the refusal tables inworking-with-a-device.mdxandcli.mdx. The failing test onbug/1168-repro(6738389) is the starting point.Written by an agent.
docs: list adb disconnect among refused commands (#1168)
test: simlock adb passes disconnect through when it is not the subcom…
V3RON commentedon Nov 1, 2026
Delivery run
Merged: #1180 (#1168)
Written by an agent.
fix(android): refuse simlock adb disconnect (callstackincubator#1180)