JuliaPy / JuliaPy/PythonCall.jl
No way to install Julia signal handler when other dependency uses juliacall
- Lenguaje dominante
- Julia
- Estrellas
- 1.1k
- Forks
- 86
- Merge medio
- 1 d 22 h
- PR fusionados (30 d)
- 3
Descripción
**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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100