Summary
After a failed or interrupted mpftp connect on WSL (COM port via the Windows sidecar), subsequent mpftp connect RPCs hang indefinitely. The only reliable recovery was to bypass the extension and talk to the board with direct python.exe -m mpremote connect COMxx ….
Environment
- Host: WSL2 (Ubuntu) + Windows COM ports
- mpftp extension:
pydevices.mpftp-0.1.1 (Cursor)
- RPC:
127.0.0.1:7429
- Sidecar: Windows
python.exe + sidecar.py
- Device: ESP32-S3 MicroPython on
COM57
What happened
- Normal connects/execs were working.
- An
exec raised a MicroPython AttributeError on the device (unrelated app bug).
- A follow-up
mpftp connect COM57 was started (to redeploy a fix).
- That connect never completed. Parallel/queued
connect RPCs also stalled.
- Activity log shows the Windows sidecar exited (
SIGTERM / later SIGKILL) while connect was in flight:
sidecar_exit → rpc_err connect: sidecar exited
- sidecar restarted (
sidecar_ready)
- new
connect RPCs were accepted but never returned rpc_ok connect
- Meanwhile, direct mpremote worked immediately:
python.exe -m mpremote connect COM57 exec "print(123)"
# → 123
So the serial port and board were fine; the hung path was mpftp’s connect/sidecar session.
Expected
- After sidecar death or a killed CLI connect, the next
mpftp connect should recover (or fail fast with a clear error).
- Queued/overlapping connects should not leave the session wedged until the Cursor window/extension is restarted.
Actual
mpftp connect COM57 hung for 60s+ with no progress.
mpftp status showed "connected": false.
- Activity log kept logging
rpc connect with no matching success.
- Had to use direct
mpremote for put/exec/soft-reset until the extension session was healthy again.
Suggested directions
- Fail fast (timeout) on connect if sidecar dies mid-flight; clear in-flight RPC state.
- On
sidecar_exit, cancel pending connect waiters and surface sidecar exited to the CLI instead of hanging.
- Debounce/serialize connect: reject a second connect while one is outstanding.
- After sidecar restart, ensure COM handle ownership is released so the next connect can open the port (direct mpremote could, so this may be an RPC waiter leak rather than a stuck OS handle).
Worked-around-with
python.exe -m mpremote connect COM57 cp ./file.py :/lib/file.py
python.exe -m mpremote connect COM57 soft-reset
python.exe -m mpremote connect COM57 exec 'print("ok")'
Happy to attach a longer ~/.mpftp/activity.log excerpt if useful.
Summary
After a failed or interrupted
mpftp connecton WSL (COM port via the Windows sidecar), subsequentmpftp connectRPCs hang indefinitely. The only reliable recovery was to bypass the extension and talk to the board with directpython.exe -m mpremote connect COMxx ….Environment
pydevices.mpftp-0.1.1(Cursor)127.0.0.1:7429python.exe+sidecar.pyCOM57What happened
execraised a MicroPythonAttributeErroron the device (unrelated app bug).mpftp connect COM57was started (to redeploy a fix).connectRPCs also stalled.SIGTERM/ laterSIGKILL) while connect was in flight:sidecar_exit→rpc_err connect: sidecar exitedsidecar_ready)connectRPCs were accepted but never returnedrpc_ok connectSo the serial port and board were fine; the hung path was mpftp’s connect/sidecar session.
Expected
mpftp connectshould recover (or fail fast with a clear error).Actual
mpftp connect COM57hung for 60s+ with no progress.mpftp statusshowed"connected": false.rpc connectwith no matching success.mpremotefor put/exec/soft-reset until the extension session was healthy again.Suggested directions
sidecar_exit, cancel pendingconnectwaiters and surfacesidecar exitedto the CLI instead of hanging.Worked-around-with
Happy to attach a longer
~/.mpftp/activity.logexcerpt if useful.