This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: asyncio: spurious ConnectionAbortedError logged on Windows
Type: Stage:
Components: asyncio Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, python-dev, sebastien.bourdeauducq, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2016-03-08 04:44 by sebastien.bourdeauducq, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fatal_error_ignore.patch vstinner, 2016-03-08 10:46 review
fatal_error_ignore-2.patch vstinner, 2016-03-11 22:46 review
Messages (8)
msg261321 - (view) Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * Date: 2016-03-08 04:44
https://github.com/python/asyncio/issues/319

On Windows, asyncio servers sometimes print such log messages when clients disconnect:

```
ERROR:master:asyncio:Fatal write error on pipe transport
protocol: <asyncio.streams.StreamReaderProtocol object at 0x0000000003F63FD0>
transport: <_ProactorSocketTransport fd=756>
Traceback (most recent call last):
  File "C:\Users\User\Miniconda3\lib\asyncio\proactor_events.py", line 283, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
  File "C:\Users\User\Miniconda3\lib\asyncio\windows_events.py", line 450, in send
    ov.WSASend(conn.fileno(), buf, flags)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software on your host machine.
```

I guess that this line:
https://github.com/python/asyncio/blob/39c135baf73762830148236da622787052efba19/asyncio/proactor_events.py#L291

should be changed to also catch ``ConnectionAbortedError``, as this exception also happens when connections are closed on Windows, in addition to ``ConnectionResetError``.
msg261340 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-08 10:46
Attached patch fixes the issue.
msg261483 - (view) Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * Date: 2016-03-10 04:42
Your patch seems to miss the ``_fatal_error`` method in ``proactor_events.py`` (which is actually where the bug happens in my application - it's using ``ProactorEventLoop``).
msg261613 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-11 22:46
> Your patch seems to miss the ``_fatal_error`` method in ``proactor_events.py`` (which is actually where the bug happens in my application - it's using ``ProactorEventLoop``).

Oops :-) What a shame. It's now fixed.

Note: _UnixReadPipeTransport._fatal_error() uses the check:

    isinstance(exc, OSError and exc.errno == errno.EIO

It doesn't use _FATAL_ERROR_IGNORE.
msg261754 - (view) Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * Date: 2016-03-14 14:18
Tested it, that works, thanks!
msg262654 - (view) Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * Date: 2016-03-30 07:39
Can someone please commit the patch?
msg262760 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-04-01 19:45
New changeset 68e694475483 by Victor Stinner in branch '3.5':
asyncio: Don't log ConnectionAbortedError
https://hg.python.org/cpython/rev/68e694475483
msg262761 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-04-01 19:45
> Can someone please commit the patch?

Done.
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70696
2016-04-01 19:45:34vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg262761
2016-04-01 19:45:15python-devsetnosy: + python-dev
messages: + msg262760
2016-04-01 19:33:53vstinnersettitle: spurious ConnectionAbortedError logged on Windows -> asyncio: spurious ConnectionAbortedError logged on Windows
2016-03-30 07:39:55sebastien.bourdeauducqsetmessages: + msg262654
2016-03-14 14:18:37sebastien.bourdeauducqsetmessages: + msg261754
2016-03-11 22:46:32vstinnersetfiles: + fatal_error_ignore-2.patch

messages: + msg261613
2016-03-10 04:42:01sebastien.bourdeauducqsetmessages: + msg261483
2016-03-08 10:46:20vstinnersetfiles: + fatal_error_ignore.patch
keywords: + patch
messages: + msg261340
2016-03-08 04:44:16sebastien.bourdeauducqcreate