[New-bugs-announce] [issue41317] sock_accept() does not remove server socket reader on cancellation

Alex Grönholm report at bugs.python.org
Thu Jul 16 18:12:05 EDT 2020


New submission from Alex Grönholm <alex.gronholm at nextday.fi>:

Unlike with all the other sock_* functions, sock_accept() only removes the reader on the server socket when the socket becomes available for reading (ie. when there's an incoming connection). If the operation is cancelled instead, the reader is not removed.

If then the server socket is closed and a new socket is created which has the same file number and it is used for a socket operation, it will cause a FileNotFoundError because the event loop thinks it has this fd registered but the epoll object does not agree since all closed sockets are automatically removed from it.

The attached script reproduces the problem on Fedora Linux 32 (all relevant Python versions), but not on Windows (on any tested Python versions from 3.6 to 3.8).

----------
components: asyncio
files: bug.py
messages: 373777
nosy: alex.gronholm, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: sock_accept() does not remove server socket reader on cancellation
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49319/bug.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41317>
_______________________________________


More information about the New-bugs-announce mailing list