Title: asyncio ProactorEventLoop: wait_closed() can raise ConnectionResetError
Type: Stage: patch review
Components: asyncio, Windows Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: asvetlov Nosy List: aeros, asvetlov, lukasz.langa, paul.moore, steve.dower, tim.golden, yselivanov, zach.ware
Priority: high Keywords: patch

Created on 2019-11-19 22:06 by yselivanov, last changed 2020-03-22 21:42 by Ido Michael.

Pull Requests
URL Status Linked Edit
PR 18199 open aeros, 2020-01-27 08:40
Messages (8)
msg356996 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2019-11-19 22:06
The exception should probably be just ignored.  Andrew, thoughts?

Here's an example error traceback:

      Traceback (most recent call last):
        File "c:\projects\asyncpg\asyncpg\", line 1227, in _cancel
          await w.wait_closed()
        File "C:\Python38\lib\asyncio\", line 376, in wait_closed
          await self._protocol._get_close_waiter(self)
        File "c:\projects\asyncpg\asyncpg\", line 1202, in _cancel
          await  # Wait until EOF
        File "C:\Python38\lib\asyncio\", line 694, in read
          block = await
        File "C:\Python38\lib\asyncio\", line 701, in read
          await self._wait_for_data('read')
        File "C:\Python38\lib\asyncio\", line 534, in _wait_for_data
          await self._waiter
        File "C:\Python38\lib\asyncio\", line 280, in _loop_reading
          data = fut.result()
        File "C:\Python38\lib\asyncio\", line 808, in _poll
          value = callback(transferred, key, ov)
        File "C:\Python38\lib\asyncio\", line 457, in finish_recv
          raise ConnectionResetError(*exc.args)
      ConnectionResetError: [WinError 64] The specified network name is no longer available
msg358097 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2019-12-09 14:18
Note: this is going to miss Python 3.8.1 as I'm releasing 3.8.1rc1 right now.  Please address this before 3.8.2 (due in February).
msg358109 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-12-09 15:01
Sorry, I've missed this issue.
I'll address it in a while.
msg360410 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-21 17:23
Why is this issue marked as a release blocker? Is it a Python 3.8 regression, or just a regular bug?
msg360742 - (view) Author: Kyle Stanley (aeros) * (Python committer) Date: 2020-01-27 08:22
> The exception should probably be just ignored.

It looks like the "ERROR_NETNAME_DELETED" (win32 error 64) exception is already ignored in multiprocessing's connection.wait(): Would it be appropriate to ignore it here as well?

I think that we should still retain the ConnectionResetError for "ERROR_OPERATION_ABORTED", but just specifically ignore "ERROR_NETNAME_DELETED". Ignoring "ERROR_OPERATION_ABORTED" doesn't seem correct here since it's relied on for cancelling file I/O (see

The patch should be straightforward. I'll test it locally and then open a PR, unless Andrew is currently working on it.
msg362633 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-02-25 12:03
Downgrading priority on this, agreed with Victor.
msg364242 - (view) Author: Ido Michael (Ido Michael) * Date: 2020-03-15 15:50
Is this open for a PR?
msg364250 - (view) Author: Kyle Stanley (aeros) * (Python committer) Date: 2020-03-15 19:38
> Is this open for a PR?

I opened a PR for this issue a bit ago (applies Yury's suggestion of suppressing the exception), just waiting on review from Andrew when he finds the time to do so.
Date User Action Args
2020-03-22 21:42:47Ido Michaelsetnosy: - Ido Michael
2020-03-16 13:39:05vstinnersetnosy: - vstinner
2020-03-15 19:38:56aerossetmessages: + msg364250
2020-03-15 15:50:33Ido Michaelsetnosy: + Ido Michael
messages: + msg364242
2020-02-25 12:03:54lukasz.langasetpriority: release blocker -> high

messages: + msg362633
2020-01-27 08:40:14aerossetkeywords: + patch
stage: patch review
pull_requests: + pull_request17577
2020-01-27 08:22:16aerossetnosy: + aeros
messages: + msg360742
2020-01-21 17:25:24vstinnersetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
components: + Windows, asyncio
2020-01-21 17:25:08vstinnersettitle: wait_closed() can raise ConnectionResetError -> asyncio ProactorEventLoop: wait_closed() can raise ConnectionResetError
2020-01-21 17:23:34vstinnersetnosy: + vstinner
messages: + msg360410
2019-12-09 15:01:41asvetlovsetassignee: asvetlov
2019-12-09 15:01:32asvetlovsetmessages: + msg358109
2019-12-09 14:18:37lukasz.langasetmessages: + msg358097
2019-11-19 22:06:26yselivanovcreate