JuliaPy / JuliaPy/PythonCall.jl

No way to install Julia signal handler when other dependency uses juliacall

未关闭
#443 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

**Affects:** JuliaCall

**Describe the bug**

Related to https://github.com/JuliaPy/PythonCall.jl/issues/219. There's currently a scenario with no possible workaround other than forcing a downstream user to set up environment variables to avoid a segfault.

Say that I import a package which uses serial Julia code. That package runs

```python
from juliacall import Main as jl
```

to start Julia.

Then, I import a different package. That package calls multithreaded Julia code, and thus to avoid a segfault (https://juliapy.github.io/PythonCall.jl/stable/faq/#Is-PythonCall/JuliaCall-thread-safe?) instead performs the import instead as:

```python
import os
os.environ["PYTHON_JULIACALL_HANDLE_SIGNALS"] = "yes"

from juliacall import Main as jl
```

However, at this point, the Julia runtime has already started. So now when I run a multithreaded portion of code, I will get a segfault, even though I implemented special workarounds in the multithreaded package.

How could I avoid this scenario? Indeed the user could always set up the environment variables themselves. But managing to figure this out from a random `bus error` will only be ~5% of users.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start by reading JuliaCall's initialization path around `from juliacall import Main as jl` and the `PYTHON_JULIACALL_HANDLE_SIGNALS` environment variable, then review the linked PythonCall.jl issue and thread-safety FAQ. Done means a package can safely arrange signal handling when another dependency has already started the Julia runtime, without requiring downstream users to discover environment-variable workarounds.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。