](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. ...
](https://static.chishengliu.com/posts/kubernetes-operator-sample-controller/cover/cover.png)
 and [Ollama](https://github.com/ollama/ollama/issues/2152)](https://static.chishengliu.com/posts/graphrag-local-ollama/cover/cover.png)
](https://static.chishengliu.com/posts/kubernetes-operator-introduction/cover/cover.png)
 on [Unsplash](https://unsplash.com/photos/a-computer-screen-with-a-bunch-of-code-on-it-ieic5Tq8YMk?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash)](https://static.chishengliu.com/posts/opensource-pre-contribution-tips/cover/cover.jpg)