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 pconnell
Recipients Johan Dahlin, db3l, emilyemorehouse, eric.snow, koobs, nascheme, ncoghlan, pconnell, pmpp, serhiy.storchaka, shprotx, steve.dower, vstinner, yselivanov
Date 2019-11-21.16:02:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574352129.36.0.130563817019.issue33608@roundup.psfhosted.org>
In-reply-to
Content
The attached patch (wrap_threadstate.diff) is enough to stop the crash. It's a slightly dirty proof-of-concept, but equally could be the basis for a solution.

The main functional issue is that there's still a race on the Py_BLOCK_THREADS side: it's possible that the "is threadstate still valid" check can pass, but the interpreter is finalised while the daemon thread is trying to reacquire the GIL in PyEval_RestoreThread.

(The Py_UNBLOCK_THREADS side is non-racy as the GIL is held while the ts and wrapper updates are done).
History
Date User Action Args
2019-11-21 16:02:09pconnellsetrecipients: + pconnell, nascheme, db3l, ncoghlan, vstinner, pmpp, eric.snow, serhiy.storchaka, yselivanov, koobs, steve.dower, emilyemorehouse, Johan Dahlin, shprotx
2019-11-21 16:02:09pconnellsetmessageid: <1574352129.36.0.130563817019.issue33608@roundup.psfhosted.org>
2019-11-21 16:02:09pconnelllinkissue33608 messages
2019-11-21 16:02:09pconnellcreate