Author Ben.Darnell
Recipients Ben.Darnell, Big Stone, asvetlov, carltongibson, lukasz.langa, mikeshardmind, njs, steve.dower, yselivanov
Date 2020-04-19.18:21:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587320507.7.0.0870457862873.issue37373@roundup.psfhosted.org>
In-reply-to
Content
> Would it be acceptable for you to *require* use of uvloop when Tornado is used with AsyncIO?

How, exactly? Adding the dependency is no problem, but AFAIK I'd still be stuck with an import-time side effect to set the event loop policy (or a .pth file hack, I guess). Maybe an import-time side effect that chooses uvloop is better since it's a functional superset of the two default windows event loops, but setting the policy at import time still has its problems (What if another module has initialized the event loop before tornado is imported? What if someone also wants to set a custom policy to work around asyncio's strict "only on the main thread" defaults?)

That's why I started this thread not asking for a proactor+selector hybrid event loop, but a better way to *configure* the event loop because policies aren't really doing the job in this case. 

> I considered using the `selectors` module directly, but it's not as simple as it sounds.

FWIW, I've reconsidered this. Treating SelectorEventLoop as a black box means you don't have enough control over synchronization and it's hard to avoid spurious wakeups and busy loops on the selector thread. I have a (broken) prototype using SelectorEventLoop that I plan to rewrite to call select.select directly.
History
Date User Action Args
2020-04-19 18:21:47Ben.Darnellsetrecipients: + Ben.Darnell, njs, asvetlov, lukasz.langa, yselivanov, steve.dower, Big Stone, mikeshardmind, carltongibson
2020-04-19 18:21:47Ben.Darnellsetmessageid: <1587320507.7.0.0870457862873.issue37373@roundup.psfhosted.org>
2020-04-19 18:21:47Ben.Darnelllinkissue37373 messages
2020-04-19 18:21:46Ben.Darnellcreate