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
[Bug]: Desktop backend outlives a crashed main process and keeps its port, so the relaunch silently moves to another port #13747
The embedded backend exits together with the main process, and the relaunched app gets 3773 again.
Actual behavior
The backend child (t3code --require …/resources/app.asar/…) survives the crash. It is reparented to systemd --user and keeps listening on 0.0.0.0:3773. The relaunched app scans past the busy port and silently moves:
selected backend port via sequential scan port: 3777 startPort: 3773
Every client pinned to 3773 (paired remote environments, MCP/CLI clients using a saved URL) then talks to the orphaned backend or gets ECONNREFUSED once it goes away. The remote UI shows Reconnecting to <host> indefinitely. Repeated crashes walk the port forward one step each time (3773 → 3777 → 3778 → 3779 in my case), because each orphan holds its port for a while.
Killing the orphan and relaunching restores 3773. I reproduced this twice on purpose (ss -ltnp showed the orphan pid on 3773 and the new instance on 3777).
Related, not duplicates: #12641 (T3 Connect keeps the link-time origin after the port changes) and #6097 (scanning past 3773 when a service owns it). This issue is about why the port changes after a crash in the first place.
Possible fixes: have the backend exit when its parent dies (PR_SET_PDEATHSIG, or exit on EOF of a parent pipe/IPC channel), and/or detect a stale backend for the same profile on startup and reclaim its port instead of scanning past it.
Arch Linux, kernel 7.2.4, KDE Plasma (KWin 6.7.5) on Wayland, Electron 44.4.2. Remote client: macOS T3 Code Nightly over Tailscale.
Logs or stack traces
# after the main process (pid 695294) crashed with SIGTRAP and the app was relaunched:
$ ss -ltnp | grep -E ':377[3-9] '
LISTEN 0 511 0.0.0.0:3773 0.0.0.0:* users:(("t3code",pid=695427,fd=3))# orphaned backend, ppid = systemd --user
LISTEN 0 511 0.0.0.0:3777 0.0.0.0:* users:(("t3code",pid=701542,fd=3))# backend of the relaunched app# remote client (macOS) keeps probing the old port:
http.client GET http://100.x.x.x:3773/.well-known/t3/environment -> connection refused / wrong instance
Workaround
Kill the orphaned backend (ss -ltnp | grep 3773, then kill that pid) and relaunch the app. Pinning T3CODE_PORT=3773 (see #12641) keeps the port stable across normal restarts, but only helps after a crash once the orphan is gone.
Before submitting
Area
apps/desktop
Steps to reproduce
http://<host>:3773as a saved environment.kill -TRAP <main pid>).Expected behavior
The embedded backend exits together with the main process, and the relaunched app gets 3773 again.
Actual behavior
The backend child (
t3code --require …/resources/app.asar/…) survives the crash. It is reparented tosystemd --userand keeps listening on0.0.0.0:3773. The relaunched app scans past the busy port and silently moves:Every client pinned to 3773 (paired remote environments, MCP/CLI clients using a saved URL) then talks to the orphaned backend or gets
ECONNREFUSEDonce it goes away. The remote UI showsReconnecting to <host>indefinitely. Repeated crashes walk the port forward one step each time (3773 → 3777 → 3778 → 3779 in my case), because each orphan holds its port for a while.Killing the orphan and relaunching restores 3773. I reproduced this twice on purpose (
ss -ltnpshowed the orphan pid on 3773 and the new instance on 3777).Related, not duplicates: #12641 (T3 Connect keeps the link-time origin after the port changes) and #6097 (scanning past 3773 when a service owns it). This issue is about why the port changes after a crash in the first place.
Possible fixes: have the backend exit when its parent dies (
PR_SET_PDEATHSIG, or exit on EOF of a parent pipe/IPC channel), and/or detect a stale backend for the same profile on startup and reclaim its port instead of scanning past it.Impact
Major degradation or frequent failure
Version or commit
0.0.43-nightly.20260926.2282 (also 0.0.43-nightly.20260925.2269)
Environment
Arch Linux, kernel 7.2.4, KDE Plasma (KWin 6.7.5) on Wayland, Electron 44.4.2. Remote client: macOS T3 Code Nightly over Tailscale.
Logs or stack traces
Workaround
Kill the orphaned backend (
ss -ltnp | grep 3773, then kill that pid) and relaunch the app. PinningT3CODE_PORT=3773(see #12641) keeps the port stable across normal restarts, but only helps after a crash once the orphan is gone.