Commit bb87ee2
Clear _bound_loop on _invalidate; clear _pool_released before pool-side close; narrow close_impl pending-drain suppress
Three client-side correctness fixes:
- ``_invalidate`` cleared every transaction-state field but did
not clear ``self._bound_loop``. After invalidation on loop A,
a reconnect on loop B was rejected by ``_check_in_use``'s
cross-loop guard even though every other state field was
scrubbed and the connection was otherwise ready for fresh
use. Three of the four lifecycle scrub sites already cleared
``_bound_loop``; this completes the parity.
- ``ConnectionPool.acquire``'s liveness short-circuit and
``_drain_idle`` both called ``conn.close()`` on connections
carrying ``_pool_released=True`` (set by the prior ``_release``).
``DqliteConnection.close()`` early-returns when ``_pool_released``
is True so user-side close on a checked-in conn is a no-op —
but the same guard silently absorbed the pool-side cleanup
close, leaking writer / reader pairs on FIN-seen idle conns
and on ``pool.close()`` cascades. Clear the flag immediately
before the close call at both sites.
- ``DqliteConnection._close_impl``'s pending-drain await wrapped
the await in ``contextlib.suppress(BaseException)``. The
in-source comment claimed parity with ``connect()``'s
pending-retire path, but connect actually uses NARROW catches
(CancelledError + Exception). asyncio cancellation gets
re-delivered at the next await boundary; signal-driven
KeyboardInterrupt / SystemExit are one-shot and were lost
forever if absorbed here. Narrow the suppress to
``(Exception, asyncio.CancelledError)``.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a251a9a commit bb87ee2
3 files changed
Lines changed: 39 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1217 | 1217 | | |
1218 | 1218 | | |
1219 | 1219 | | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1229 | 1231 | | |
1230 | 1232 | | |
1231 | 1233 | | |
| |||
1489 | 1491 | | |
1490 | 1492 | | |
1491 | 1493 | | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1492 | 1502 | | |
1493 | 1503 | | |
1494 | 1504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
604 | 613 | | |
605 | 614 | | |
606 | 615 | | |
| |||
867 | 876 | | |
868 | 877 | | |
869 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
870 | 887 | | |
871 | 888 | | |
872 | 889 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
0 commit comments