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 sourcejedi
Recipients asvetlov, njs, sourcejedi, vstinner, yselivanov
Date 2020-10-21.16:43:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603298607.16.0.804931248036.issue35749@roundup.psfhosted.org>
In-reply-to
Content
Here's a simple test case that fails on the main branch.

https://github.com/sourcejedi/cpython/commit/50184ea3b354fd775866d036ccee058ec6734927

> the patch assumes that python signal handler will be called *before* reading from self-pipe. 
> Otherwise, a signal callback will be postponed up to next writing to the pipe, which looks like a hidden bug.

I think it will be?  I can imagine it being a concern for future changes though.  I thought it could break if anyone takes seriously the comment "XXX Signals should be recorded per thread, now we have thread state." :-).

But if we're not confident, surely all we have to do is make sure to call _write_to_self() at the end of the python signal handler (_UnixSelectorEventLoop._sig_handler()).

It seems a pity not to have example code we can point to, that handles signals correctly.  Even if it's too tedious to explain the correct way in the official docs.
History
Date User Action Args
2020-10-21 16:43:27sourcejedisetrecipients: + sourcejedi, vstinner, njs, asvetlov, yselivanov
2020-10-21 16:43:27sourcejedisetmessageid: <1603298607.16.0.804931248036.issue35749@roundup.psfhosted.org>
2020-10-21 16:43:27sourcejedilinkissue35749 messages
2020-10-21 16:43:27sourcejedicreate