Commit a7c4e44
committed
fix: remove dead LSP clients to prevent unbounded memory growth
When an LSP connection dies, the dead client stays in the active list
forever. Every subsequent file write/edit retries it, waits 3s for
diagnostics, and leaks memory. Over days this compounds to GB-scale
growth (observed: 16.9 GB from 807 retries across 129 files).
- Register connection.onClose() to detect dead connections proactively
- Remove dead clients from s.clients and add to s.broken on first failure
- Per-client error handling in touchFile so one dead client doesn't
affect others
- Add write tool guidance to avoid rapid successive writes
Relates to #13796, #15675, #166971 parent 9c00669 commit a7c4e44
3 files changed
Lines changed: 44 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
79 | 88 | | |
80 | 89 | | |
81 | 90 | | |
| |||
141 | 150 | | |
142 | 151 | | |
143 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
144 | 156 | | |
145 | 157 | | |
146 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
278 | 289 | | |
279 | 290 | | |
| 291 | + | |
280 | 292 | | |
281 | 293 | | |
282 | 294 | | |
283 | | - | |
284 | | - | |
285 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
286 | 312 | | |
287 | | - | |
288 | | - | |
289 | | - | |
| 313 | + | |
290 | 314 | | |
291 | 315 | | |
292 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
0 commit comments