Uh oh!
There was an error while loading. Please reload this page.
asyncio connection_pool: catch CanceledError exception fix connection… - #305
Conversation
florimondmanca
commented
Apr 20, 2021
Thanks @aviramha It seems we'd need to fit this into our async backends layer, so that it also works with eg trio (though I'm not sure if we can reproduce the issue there?). Essentially I think we want the usage to be |
aviramha
commented
Apr 20, 2021
I'm not sure what's the functional/design benefit from such behavior - this is the async implementation of connection pool, and catching "CanceledError" in trio won't really do anything anyway so why does it matter? |
lovelydinosaur
commented
Apr 20, 2021
So, Trio's I don't think it'd be a terrible idea for us to just catch Either... exceptNewConnectionRequired:
connection=NoneexceptBaseException: # noqa: PIE786# Note that we catch BaseException here in order to also support# removing connections from the pool on task cancellations.logger.trace("remove from pool connection=%r", connection)
awaitself._remove_from_pool(connection)
raiseOr perhaps... exceptNewConnectionRequired:
connection=NoneexceptBaseException: # noqa: PIE786try:
logger.trace("remove from pool connection=%r", connection)
awaitself._remove_from_pool(connection)
finally:
raise |
aviramha
commented
Apr 20, 2021
@tomchristie I tend to agree. I updated the PR. |
f8e9f35 to
12cdeeaCompare… leak in case of cacncellations
12cdeea to
912c351CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lovelydinosaur
commented
Apr 21, 2021
Thanks @aviramha! |
Thank you for this well maintained library! |
… leak in case of cacncellations
closes#149
closeshttps://github.com/encode/httpx/issues/1461