Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
Consider the following server that always just crashes:
importasyncioasyncdefhandle_echo(reader,writer):raiseException("I break everything")asyncdefmain():server=awaitasyncio.start_server(handle_echo,'127.0.0.1',8888)asyncwithserver:awaitserver.serve_forever()asyncio.run(main(),debug=True)
Together with the following client:
importasyncioasyncdeftcp_echo_client(message):reader,writer=awaitasyncio.open_connection('127.0.0.1',8888)data=awaitreader.read(100)print(data)writer.close()awaitwriter.wait_closed()print("closed")asyncio.run(tcp_echo_client('Hello World!'),debug=True)
When running this in Python 3.8, the server prints aTask exception was never retrieved message with an exception. I guess this is acceptable. However, the connection is never closed, and the client is kept hanging. That should not happen in my opinion.
Furthermore, in newer Python versions, due to#96323, the internal task is being kept alive indefinitely. Therefore, theTask exception was never retrieved message is only printed when you kill the server. Otherwise, the failure is completely silent. This is extremely counter-intuitive behavior.
CPython versions tested on:
3.11
Operating systems tested on:
Linux
Linked PRs
- GH-110894: Call loop exception handler for exceptions in client_connected_cb #111601
- [3.12] GH-110894: Call loop exception handler for exceptions in client_connected_cb (GH-111601) #111632
- [3.11] [3.12] GH-110894: Call loop exception handler for exceptions in client_connected_cb (GH-111601) (GH-111632) #111634
Metadata
Metadata
Assignees
Labels
Projects
Status
Done