Should kernel restart interrupt running code?
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
研究方向
從 issue 中的 notebook 儲存格 reproducer 開始,比較執行期間重新啟動 kernel 與先中斷 kernel 的情況。追蹤 kernel 的重新啟動和關閉行為,以判斷正在執行的直譯器是否應接收 SIGINT,接著確認預期的清理路徑完成後,atexit 處理常式是否會移除暫存檔案。
由索引模型根據 Issue 內容生成。
描述
I'm not sure if this is a bug or intended behavior. AFAICT, if a user restarts a kernel while the interpreter is actively processing, no SIGINT is sent to the interpreter process, and eventually the process is SIGKILL'd. This can lead to atexit handlers never running.
This is causing issues in dask, where we use atexit handlers to ensure remote resources are reclaimed.
Here's a reproducer. Paste this into a notebook cell, run, then restart the kernel before the cell finishes executing.
import atexit
import os
import time
with open("temp-file", "w") as f:
f.write("This file should be deleted by the exit handler")
@atexit.register
def exit_handler():
os.unlink("temp-file")
time.sleep(1000)
# Restart the kernel, `temp-file` should be deleted but isn't.
# If you interrupt, then restart, then `temp-file` is deleted
If you instead interrupt the kernel then restart it, everything is cleaned up properly. Is this intended behavior (and the issue is user workflow, rather than a possible bug)?
- 主要語言
- Python
- 星號
- 734
- 分支
- 411
- 平均合併
- 1 天 2 小時
- 30 天內合併 PR
- 9
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
ipython/ipykernel 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 1/5 1 小時以內 新手友好度 72/100
-
難度 4/5 3-5 天 新手友好度 48/100
-
難度 4/5 3-5 天 新手友好度 68/100
查看 ipython/ipykernel 的全部 Issue
相似的 Issue
-
bug confirmed issue
難度 2/5 1-3 小時 新手友好度 75/100
open-webui/open-webui#30750 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
enhancement
難度 2/5 1-3 小時 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
-
good first issue
難度 1/5 1 小時以內 新手友好度 90/100