Commit 16ec20f
committed
Fix CapacityLimiter._pending_borrowers leak on non-Cancelled exceptions
acquire_on_behalf_of only catches trio.Cancelled when cleaning up
_pending_borrowers. If park() raises any other exception (e.g.
KeyboardInterrupt delivered via the abort mechanism), the task's
entry remains in _pending_borrowers permanently. This is a slow
memory leak and can also cause _wake_waiters to encounter stale
entries.
Broaden the handler to BaseException and use pop with a default
to be safe against double-removal.1 parent 2fd138e commit 16ec20f
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
| 380 | + | |
| 381 | + | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| |||
0 commit comments