Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
Closed as not planned
Copy link
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The code below works perfectly on Python 3.11.4 but fails with ConnectionResetError on Python 3.11.5
importasyncioHOST='ifconfig.me'PORT=80asyncdefconnect() ->asyncio.Transport: reader, writer=awaitasyncio.open_connection( host=HOST, port=PORT, ) returnwriter.transport# type: ignoreasyncdeffetch(): loop=asyncio.get_running_loop() transport=awaitconnect() # transport is already closed here on 3.11.5reader=asyncio.StreamReader(limit=2**16, loop=loop) protocol=asyncio.StreamReaderProtocol(reader, loop=loop) transport.set_protocol(protocol) loop.call_soon(protocol.connection_made, transport) loop.call_soon(transport.resume_reading) writer=asyncio.StreamWriter( transport=transport, protocol=protocol, reader=reader, loop=loop, ) request=f'GET /ip HTTP/1.1\r\nHost: {HOST}\r\nConnection: close\r\n\r\n'.encode() writer.write(request) awaitwriter.drain() response=awaitreader.read(-1) print(response) writer.close() if__name__=='__main__': asyncio.run(fetch())Traceback (most recent call last): File "/home/rigens/aio_test1.py", line 50, in <module> asyncio.run(fetch()) File "/usr/local/miniconda/envs/py311_5/lib/python3.11/asyncio/runners.py", line 190, in runreturn runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/miniconda/envs/py311_5/lib/python3.11/asyncio/runners.py", line 118, in runreturnself._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/miniconda/envs/py311_5/lib/python3.11/asyncio/base_events.py", line 653, in run_until_completereturn future.result() ^^^^^^^^^^^^^^^ File "/home/rigens/aio_test1.py", line 41, in fetchawait writer.drain() File "/usr/local/miniconda/envs/py311_5/lib/python3.11/asyncio/streams.py", line 378, in drainawaitself._protocol._drain_helper() File "/usr/local/miniconda/envs/py311_5/lib/python3.11/asyncio/streams.py", line 167, in _drain_helperraiseConnectionResetError('Connection lost') ConnectionResetError: Connection lostCPython versions tested on:
3.11
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done