Repository navigation
Commit 14779d1
fix(connection): tolerate a slow-but-alive local backend + heap headroom
Under host memory pressure the local ("This device") backend answers
slowly, and the reconnect supervisor abandoned each attempt at a fixed
15s budget and then backed off — repeatedly giving up on a
briefly-slow-but-alive backend (issue #21).
Client (packages/client-runtime/src/connection/supervisor.ts):
- Classify a setup timeout that reached the backend (stage
opening/synchronizing) as "slow, not dead": the next attempt gets a
45s establishment budget and a fast 1s retry instead of climbing the
exponential ladder. Timeouts that never reached the backend keep the
existing 15s budget + exponential backoff.
- Bound the tolerant path to MAX_TOLERANT_TIMEOUTS (3) consecutive slow
timeouts, then fall back to normal backoff — the stages are reported
before the socket is confirmed open, so a genuinely unreachable
endpoint must not loop on 45s attempts forever.
- Add a 30s background liveness probe (monitorConnectedLease) so a
wedged-but-open socket is detected without waiting for foreground
activation; the foreground probe was refactored into a shared helper
that also handles a relay credentials-change arriving mid-probe.
Desktop (apps/desktop/src/backend/DesktopBackendConfiguration.ts):
- Give the backend --max-old-space-size=4096 heap headroom (appended to
NODE_OPTIONS for the Electron-run-as-node primary, passed as a V8
execArg for WSL).
Server-side WS keep-alive/idleTimeout is deferred (the Effect beta
transport exposes no idle option and the RPC client pinger already
provides client->server liveness) — documented in the PR.
Co-Authored-By: Claude Opus 4.8 <[email protected]>1 parent 6dc983f commit 14779d1
4 files changed
Lines changed: 555 additions & 47 deletions
File tree
- apps/desktop/src/backend
- packages/client-runtime/src/connection
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
| |||
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
155 | 195 | | |
156 | 196 | | |
157 | 197 | | |
| |||
279 | 319 | | |
280 | 320 | | |
281 | 321 | | |
| 322 | + | |
| 323 | + | |
282 | 324 | | |
283 | 325 | | |
284 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
97 | 121 | | |
98 | 122 | | |
99 | 123 | | |
| |||
356 | 380 | | |
357 | 381 | | |
358 | 382 | | |
| 383 | + | |
359 | 384 | | |
360 | 385 | | |
361 | 386 | | |
| |||
546 | 571 | | |
547 | 572 | | |
548 | 573 | | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
549 | 578 | | |
550 | 579 | | |
551 | 580 | | |
| |||
0 commit comments