|
3 | 3 | Pins the ``ConnectionPool`` lifecycle guarantees against cancellation |
4 | 4 | and partial failures: |
5 | 5 |
|
6 | | -- Cancelling a parked ``acquire()`` caller must not leak ``_size`` |
7 | | - (ISSUE-71 + ISSUE-76). ``_size`` must reflect reality at all times. |
| 6 | +- Cancelling a parked ``acquire()`` caller must not leak ``_size``. |
| 7 | + ``_size`` must reflect reality at all times. |
8 | 8 | - ``pool.close()`` must wake every parked acquirer via the close |
9 | | - signal, not via the per-poll timeout (ISSUE-74). Waking via timeout |
10 | | - would produce "Timed out waiting for a connection" instead of |
| 9 | + signal, not via the per-poll timeout. Waking via timeout would |
| 10 | + produce "Timed out waiting for a connection" instead of |
11 | 11 | "Pool is closed" — the message is the observable signal. |
12 | 12 | - ``_reset_connection`` failure during cleanup must release the |
13 | | - reservation and effectively close the connection (ISSUE-76). |
14 | | - ``_FakeConn`` replicates the real ``DqliteConnection.close`` |
15 | | - early-return guard on ``_pool_released``, so any regression that |
16 | | - flips the flag before calling close() surfaces as a failed |
17 | | - ``close_effective`` assertion. |
| 13 | + reservation and effectively close the connection. ``_FakeConn`` |
| 14 | + replicates the real ``DqliteConnection.close`` early-return guard |
| 15 | + on ``_pool_released``, so any regression that flips the flag |
| 16 | + before calling close() surfaces as a failed ``close_effective`` |
| 17 | + assertion. |
18 | 18 | - ``initialize()`` partial failure: sibling connections that already |
19 | 19 | succeeded must be effectively closed before ``gather()`` propagates |
20 | | - the first failure (ISSUE-77). The previous default |
| 20 | + the first failure. The previous default |
21 | 21 | ``return_exceptions=False`` cancelled siblings but did NOT close |
22 | 22 | them, leaking transports. |
23 | 23 |
|
@@ -120,10 +120,10 @@ async def _default_connect(**kwargs: Any) -> _FakeConn: |
120 | 120 |
|
121 | 121 |
|
122 | 122 | class TestInitializePartialFailureClosesSurvivors: |
123 | | - """ISSUE-77: if a single _create_connection fails in initialize's |
124 | | - gather, the connections that already succeeded must be closed. |
125 | | - Currently they leak (asyncio.gather cancels siblings but does not |
126 | | - await their .close()). |
| 123 | + """If a single _create_connection fails in initialize's gather, |
| 124 | + the connections that already succeeded must be closed. Previously |
| 125 | + they leaked (asyncio.gather cancels siblings but does not await |
| 126 | + their .close()). |
127 | 127 | """ |
128 | 128 |
|
129 | 129 | async def test_survivors_closed_on_partial_init_failure(self) -> None: |
@@ -170,10 +170,10 @@ async def _flaky_connect(**kwargs: Any) -> _FakeConn: |
170 | 170 |
|
171 | 171 |
|
172 | 172 | class TestAcquireCancellationRestoresSize: |
173 | | - """ISSUE-71 + ISSUE-76: a caller cancelled while parked in acquire() |
174 | | - must not leak the pool reservation. If a connection was pulled off |
175 | | - the queue and handed to the cancelled task's get_task, it must either |
176 | | - be returned to the pool or closed with _size decremented. Likewise |
| 173 | + """A caller cancelled while parked in acquire() must not leak the |
| 174 | + pool reservation. If a connection was pulled off the queue and |
| 175 | + handed to the cancelled task's get_task, it must either be |
| 176 | + returned to the pool or closed with _size decremented. Likewise |
177 | 177 | for body-raised cancellation during yield cleanup. |
178 | 178 | """ |
179 | 179 |
|
@@ -215,9 +215,9 @@ async def waiter() -> None: |
215 | 215 | await pool.close() |
216 | 216 |
|
217 | 217 | async def test_reset_connection_failure_releases_reservation(self) -> None: |
218 | | - """ISSUE-76: when the pool's cleanup path runs _reset_connection |
219 | | - and it fails (e.g. ROLLBACK raises), the reservation must be |
220 | | - released and the connection closed — never leaked. |
| 218 | + """When the pool's cleanup path runs _reset_connection and it |
| 219 | + fails (e.g. ROLLBACK raises), the reservation must be released |
| 220 | + and the connection closed — never leaked. |
221 | 221 | """ |
222 | 222 |
|
223 | 223 | class _RollbackFailingConn(_FakeConn): |
@@ -271,8 +271,8 @@ class _BodyError(Exception): |
271 | 271 |
|
272 | 272 |
|
273 | 273 | class TestCloseWakesAllWaiters: |
274 | | - """ISSUE-74: when pool.close() runs, every parked acquire() must |
275 | | - return DqliteConnectionError promptly. The current clear()-then-wait |
| 274 | + """When pool.close() runs, every parked acquire() must return |
| 275 | + DqliteConnectionError promptly. The current clear()-then-wait |
276 | 276 | pattern has a tiny window where close()'s set() can be erased, |
277 | 277 | leaving waiters stalled until timeout. |
278 | 278 | """ |
|
0 commit comments