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 <yus...@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@python.org
> https://mail.python.org/mailman/listinfo/async-sig
> Code of Conduct: https://www.python.org/psf/codeofconduct/
>
_______________________________________________
Async-sig mailing list
Async-sig@python.org
https://mail.python.org/mailman/listinfo/async-sig
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to