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.

Author alex.gronholm
Recipients alex.gronholm, asvetlov, yselivanov
Date 2020-07-16.22:12:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594937525.52.0.117066426287.issue41317@roundup.psfhosted.org>
In-reply-to
Content
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).
History
Date User Action Args
2020-07-16 22:12:05alex.gronholmsetrecipients: + alex.gronholm, asvetlov, yselivanov
2020-07-16 22:12:05alex.gronholmsetmessageid: <1594937525.52.0.117066426287.issue41317@roundup.psfhosted.org>
2020-07-16 22:12:05alex.gronholmlinkissue41317 messages
2020-07-16 22:12:05alex.gronholmcreate