JuliaPy / JuliaPy/PythonCall.jl

holding GIL on non-sticky tasks leads to undefined behavior

未關閉
#809 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Julia
星號
1.1k
分支
86
平均合併
1 天 22 小時
30 天內合併 PR
3

描述

**Affects:** PythonCall

**Describe the bug**

Because the Python GIL is specific to an _OS thread_, but Julia tasks can migrate across threads when they're paused/resumed, locking the GIL from Julia on a non-sticky thread leads to undefined behavior (segfaults, deadlocks, etc.).

I think probably the way to handle this is to mark the current task as sticky in `GIL.@lock` and friends. It's really hard to get this right in libraries that wrap provide python functionality because even if callers know they need to lock the GIL, they may not know about task stickiness.

**Your system**

We've seen this across a wide variety of environments, Julia 1.10 to 1.12, macOS and ubuntu.

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start with GIL.@lock and related locking helpers, then inspect how Julia tasks can migrate between OS threads and how task stickiness is controlled. Reproduce the reported segfault or deadlock cases on the affected Julia versions, and add coverage showing that GIL-protected work does not run on a migratable task.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
julia, python
領域
operating-systems
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
活躍
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。