JuliaPy / JuliaPy/PythonCall.jl

holding GIL on non-sticky tasks leads to undefined behavior

Đang mở
#809 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Julia
Star
1.1k
Fork
86
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
3

Mô tả

**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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
julia, python
Lĩnh vực
operating-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.