You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AsyncTransport.close() sets _closed before aclose(); cancellation leaks the pool #333
The #301 idempotency fix sets self._closed = True before awaiting self._client.aclose(). If the surrounding task is cancelled at the await point, the _closed flag is already set but aclose has not finished draining the connection pool. A retry path that catches CancelledError, performs cleanup, and calls close() again — the canonical pattern for async with under a parent timeout — gets a silent no-op, and the underlying httpx.AsyncClient pool is permanently orphaned until GC reaps the client.
The docstring's "fully race-free under cooperative scheduling" claim glosses over this: cooperative scheduling explicitly includes cancellation as an interleaving point. The sync close() has the same shape but cancellation isn't applicable.
This means a cancellation through the await re-raises with _closed still False, so a retry actually drains the pool. Add a regression test that cancels the task awaiting close(), then awaits it again on the same instance, asserting httpx.AsyncClient.is_closed is True after the second call.
Activity
polish(transport): async close cancellation-safe + _delete_with_body …