[Async-sig] set_blocking_signal_threshold equivalent for asyncio?

Ben Darnell ben at bendarnell.com
Fri Feb 8 20:37:22 EST 2019


Asyncio's debug mode does this (and a few more things). Call
`asyncio.get_event_loop().set_debug()` to enable it.

https://docs.python.org/3/library/asyncio-dev.html#debug-mode

-Ben

On Fri, Feb 8, 2019 at 5:10 PM Yusuke Tsutsumi <yusuke at tsutsumi.io> wrote:

> Hi,
>
> In tornado, there's a really nice feature called
> set_blocking_signal_threshold, which sets a signal that fires if a
> coroutine has been running for too long without returning control back to
> the main loop:
>
>
> https://www.tornadoweb.org/en/stable/ioloop.html?highlight=signal#tornado.ioloop.IOLoop.set_blocking_signal_threshold
>
> In tornado this will then log the traceback of the coroutine in question.
> This has been a very valuable tool when a developer accidentally introduces
> code that blocks the event loop for way too long of a time.
>
> Is there an equivalent in asyncio? I have a sketch in my head of how to
> implement that, but wanted to see if it existed somewhere first.
>
> Thanks!
> -Yusuke
> _______________________________________________
> Async-sig mailing list
> Async-sig at python.org
> https://mail.python.org/mailman/listinfo/async-sig
> Code of Conduct: https://www.python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/async-sig/attachments/20190208/c3f71b15/attachment.html>


More information about the Async-sig mailing list