-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugreproducer: missingThis PR or issue lacks code, which reproduce the problem described or clearly understandable STRThis PR or issue lacks code, which reproduce the problem described or clearly understandable STR
Description
Describe the bug
V3.12.4 Introduced a regression, in which, session with some proxies can't be closed.
Originally posted: #11261
To Reproduce
Done never prints here:
import asyncio
from aiohttp import ClientSession
async def main():
proxy = ""
session = ClientSession(proxy=proxy)
async with session.get(
"https://api.ipify.org/",
) as response:
ip = await response.text()
print("Closing session...")
await session.close()
print("Done")
return ip
asyncio.run(main())
Using async with
not help.
Expected behavior
Aiohttp closes session, without running forever
Logs/tracebacks
3.12.3:
C:\Users\topsp\OneDrive\Desktop\project>pip install aiohttp==3.12.4
Collecting aiohttp==3.12.4
Using cached aiohttp-3.12.4-cp313-cp313-win_amd64.whl.metadata (7.9 kB)
Requirement already satisfied: aiohappyeyeballs>=2.5.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.4) (2.6.1)
Requirement already satisfied: aiosignal>=1.1.2 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.4) (1.3.2)
Requirement already satisfied: attrs>=17.3.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.4) (25.3.0)
Requirement already satisfied: frozenlist>=1.1.1 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.4) (1.5.0)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.4) (6.1.0)
Requirement already satisfied: propcache>=0.2.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.4) (0.2.1)
Requirement already satisfied: yarl<2.0,>=1.17.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.4) (1.18.3)
Requirement already satisfied: idna>=2.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from yarl<2.0,>=1.17.0->aiohttp==3.12.4) (3.10)
Using cached aiohttp-3.12.4-cp313-cp313-win_amd64.whl (439 kB)
Installing collected packages: aiohttp
Attempting uninstall: aiohttp
Found existing installation: aiohttp 3.12.3
Uninstalling aiohttp-3.12.3:
Successfully uninstalled aiohttp-3.12.3
Successfully installed aiohttp-3.12.4
C:\Users\topsp\OneDrive\Desktop\project>python script.py
Closing session...
Traceback (most recent call last):
File "C:\Users\topsp\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Users\topsp\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "C:\Users\topsp\OneDrive\Desktop\project\script.py", line 15, in main
await connector.close()
File "C:\Users\topsp\AppData\Local\Programs\Python\Python313\Lib\site-packages\aiohttp\connector.py", line 137, in _wait_for_close
results = await asyncio.gather(*waiters, return_exceptions=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\topsp\OneDrive\Desktop\project\script.py", line 21, in <module>
asyncio.run(main(), debug=True)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "C:\Users\topsp\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "C:\Users\topsp\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 123, in run
raise KeyboardInterrupt()
KeyboardInterrupt
3.12.4:
C:\Users\topsp\OneDrive\Desktop\project>pip install aiohttp==3.12.3
Collecting aiohttp==3.12.3
Using cached aiohttp-3.12.3-cp313-cp313-win_amd64.whl.metadata (7.9 kB)
Requirement already satisfied: aiohappyeyeballs>=2.5.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.3) (2.6.1)
Requirement already satisfied: aiosignal>=1.1.2 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.3) (1.3.2)
Requirement already satisfied: attrs>=17.3.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.3) (25.3.0)
Requirement already satisfied: frozenlist>=1.1.1 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.3) (1.5.0)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.3) (6.1.0)
Requirement already satisfied: propcache>=0.2.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.3) (0.2.1)
Requirement already satisfied: yarl<2.0,>=1.17.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from aiohttp==3.12.3) (1.18.3)
Requirement already satisfied: idna>=2.0 in c:\users\topsp\appdata\roaming\python\python313\site-packages (from yarl<2.0,>=1.17.0->aiohttp==3.12.3) (3.10)
Using cached aiohttp-3.12.3-cp313-cp313-win_amd64.whl (438 kB)
Installing collected packages: aiohttp
Attempting uninstall: aiohttp
Found existing installation: aiohttp 3.12.4
Uninstalling aiohttp-3.12.4:
Successfully uninstalled aiohttp-3.12.4
Successfully installed aiohttp-3.12.3
C:\Users\topsp\OneDrive\Desktop\project>python script.py
Closing session...
Done
Python Version
Python 3.13.5
aiohttp Version
aiohttp==3.12.13
multidict Version
multidict==6.6.3
propcache Version
propcache==0.3.2
yarl Version
yarl==1.20.1
OS
Windows 10
Related component
Client
Additional context
Thank you for investigating this issue.
Code of Conduct
- I agree to follow the aio-libs Code of Conduct
Metadata
Metadata
Assignees
Labels
bugreproducer: missingThis PR or issue lacks code, which reproduce the problem described or clearly understandable STRThis PR or issue lacks code, which reproduce the problem described or clearly understandable STR