Skip to content

Bug #564

Description

@AmericanY
importtrioimporthttpxasyncdefworker(client, nurse):
r=awaitclient.head('https://google.com')
nurse.cancel_scope.cancel()
asyncdefmain():
asyncwithhttpx.AsyncClient(timeout=None) asclient, trio.open_nursery() asnurse:
for_inrange(3):
nurse.start_soon(worker, client, nurse)
if__name__=="__main__":
trio.run(main)
Traceback (most recent call last):
File "c:\Users\AmericaN\Desktop\Lab\test.py", line 17, in <module>
trio.run(main)
File "C:\Users\AmericaN\Desktop\Lab\MyEnv\lib\site-packages\trio\_core\_run.py", line 1946, in run
raise runner.main_task_outcome.error
File "c:\Users\AmericaN\Desktop\Lab\test.py", line 11, in main
async with httpx.AsyncClient(timeout=None) as client, trio.open_nursery() as nurse:
File "C:\Users\AmericaN\Desktop\Lab\MyEnv\lib\site-packages\httpx\_client.py", line 1997, in __aexit__
await self._transport.__aexit__(exc_type, exc_value, traceback)
File "C:\Users\AmericaN\Desktop\Lab\MyEnv\lib\site-packages\httpx\_transports\default.py", line 332, in __aexit__
await self._pool.__aexit__(exc_type, exc_value, traceback)
File "C:\Users\AmericaN\Desktop\Lab\MyEnv\lib\site-packages\httpcore\_async\connection_pool.py", line 326, in __aexit__
await self.aclose()
File "C:\Users\AmericaN\Desktop\Lab\MyEnv\lib\site-packages\httpcore\_async\connection_pool.py", line 312, in aclose
raise RuntimeError(
RuntimeError: The connection pool was closed while 2 HTTP requests/responses were still in-flight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions