JuliaPy / JuliaPy/PythonCall.jl

holding GIL on non-sticky tasks leads to undefined behavior

オープン
#809 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Julia
スター
1.1k
フォーク
86
平均マージ
1日 22時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。