](https://static.chishengliu.com/posts/run-coroutine-threadsafe-systemexit/cover/cover.jpg)
SystemExit 使 asyncio.run_coroutine_threadsafe 永遠卡住
今天在 debug Ray 的某個 issue 的時候,因為沒注意到 Python 的 asyncio.run_coroutine_threadsafe 的特殊行為,官方 doc 沒有特別說明,要去看 CPython source code 才知道,導致 debug 了有點久的時間,特此紀錄。 根據 官方文檔 ,這個 function 是用來把一個 coroutine 跑在另一個 thread 上面的 event loop 裡面,然後他會 return 一個 Future object。 ...