Author njs
Recipients Mark.Shannon, deleted0524, erik.bray, gregory.p.smith, jdemeyer, ncoghlan, njs, xgdomingo, yselivanov
Date 2017-09-07.18:45:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1504809929.36.0.33987614418.issue29988@psf.upfronthosting.co.za>
In-reply-to
Content
FWIW trio's strategy for handling this is to install a clever signal handle that routes the signal to the event loop IF the signal arrives while the event loop is running, or while particularly sensitive code like trio.Lock.__aexit__ is running. The rest of the time it raises KeyboardInterrupt directly. So we actually can have signal safety and deal with runaway coroutines at the same time, and this patch does provide a meaningful reduction in race conditions for trio [1]. In principle there's nothing stopping asyncio or other coroutine runners from implementing a similar strategy.

[1] actually this is currently a lie, because this patch reveals another independent race condition: there's no way for my clever signal handler to tell that it's in a sensitive function like trio.Lock.__aexit__ if it runs on the very first bytecode of the function, before the function has had a chance to mark itself as sensitive. But *that's* fixable with something like bpo-12857.
History
Date User Action Args
2017-09-07 18:45:29njssetrecipients: + njs, gregory.p.smith, ncoghlan, Mark.Shannon, erik.bray, jdemeyer, yselivanov, deleted0524, xgdomingo
2017-09-07 18:45:29njssetmessageid: <1504809929.36.0.33987614418.issue29988@psf.upfronthosting.co.za>
2017-09-07 18:45:29njslinkissue29988 messages
2017-09-07 18:45:29njscreate