You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
StreamWriter.wait_closed() can hang indefinitely. #83939
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2020-02-26.10:36:06.728>labels= ['3.11', 'type-bug', 'expert-asyncio']
title='StreamWriter.wait_closed() can hang indefinitely.'updated_at=<Date2022-03-03.11:14:26.540>user='https://github.com/tomchristie'
I am also seeing this in Python 3.8.6. I am not using SSL, but am simply calling await writer.wait_closed() on an asyncio.StreamWriter. Sometimes it works quickly and sometimes it hangs indefinitely.
r-owen commented on Feb 25, 2021
r-owenmannequin
Mannequin
More actions
Regarding my previous comment: I have never seen this in Python 3.7 (though I see that this particular bug is listed as being present there) so it may be a different underlying issue.
seer commented on Sep 1, 2021
seermannequin
Mannequin
More actions
See this issue on 3.9.6
No SSL, but plain sockets.
This seems to appear when writer.write/writer.drain was cancelled, and writer.close/writer.wait_closed called after this.
On main branch with rewritten SSL implementation #75458bpo-44011, this raises TimeoutError:
--------------------------------------------------------------------------------
opened
close started
Traceback (most recent call last):
File "/workspaces/cpython/main.py", line 18, in <module>
asyncio.run(main())
^^^^^^^^^^^^^^^^^^^
File "/workspaces/cpython/Lib/asyncio/runners.py", line 44, in runreturn loop.run_until_complete(main)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/cpython/Lib/asyncio/base_events.py", line 645, in run_until_completereturn future.result()
^^^^^^^^^^^^^^^
File "/workspaces/cpython/main.py", line 14, in mainawait writer.wait_closed()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/cpython/Lib/asyncio/streams.py", line 344, in wait_closedawaitself._protocol._get_close_waiter(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^TimeoutError: SSL shutdown timed out
This issue has been fixed, it can be closed @asvetlov.
Activity
tomchristie commentedon Feb 26, 2020
Raising an issue that's impacting us on
httpx.It appears that in some cases SSL unwrapping can cause
.wait_closed()to hang indefinately.Trio are particularly careful to work around this case, and have an extensive comment on it: https://github.com/python-trio/trio/blob/31e2ae866ad549f1927d45ce073d4f0ea9f12419/trio/_ssl.py#L779-L829
Originally raised via encode/httpx#634
Tested on:
[-]StreamWriter.wait_closed() can hang indefinately.[/-][+]StreamWriter.wait_closed() can hang indefinitely.[/+]JulienPalard commentedon Feb 26, 2020
Can reproduce in:
r-owen commentedon Feb 25, 2021
I am also seeing this in Python 3.8.6. I am not using SSL, but am simply calling
await writer.wait_closed()on anasyncio.StreamWriter. Sometimes it works quickly and sometimes it hangs indefinitely.r-owen commentedon Feb 25, 2021
Regarding my previous comment: I have never seen this in Python 3.7 (though I see that this particular bug is listed as being present there) so it may be a different underlying issue.
seer commentedon Sep 1, 2021
See this issue on 3.9.6
No SSL, but plain sockets.
This seems to appear when writer.write/writer.drain was cancelled, and writer.close/writer.wait_closed called after this.
4 remaining items
kumaraditya303 commentedon Mar 3, 2022
On main branch with rewritten SSL implementation #75458 bpo-44011, this raises TimeoutError:
--------------------------------------------------------------------------------
opened
close started
This issue has been fixed, it can be closed @asvetlov.