](https://static.chishengliu.com/posts/run-coroutine-threadsafe-systemexit/cover/cover.jpg)
SystemExit Hangs asyncio.run_coroutine_threadsafe
Today, while debugging an issue with Ray, I encountered a problem because I did not notice the special behavior of Python’s asyncio.run_coroutine_threadsafe. The official documentation does not explicitly mention it; you have to look at the CPython source code to understand what is happening, which led to a long debugging session. I am documenting this issue here. According to the official documentation , this function is used to run a coroutine in an event loop on another thread, and it returns a Future object. ...