JuliaPy / JuliaPy/PyCall.jl

Do something about PYTHONFAULTHANDLER?

Offen
#884 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

It seems at least on Linux, setting the environment variable `PYTHONFAULTHANDLER=1` (enabling a Python-builtin package as of recent versions https://docs.python.org/3/library/faulthandler.html) causes segfaults with PyCall. The MWE I've been using is

```julia
# script.jl

using PyCall

Threads.@sync begin
Threads.@spawn GC.gc(true)
Threads.@spawn GC.gc(true)
end
```

Run `julia --threads=2 script.jl` and its fine, but run `PYTHONFAULTHANDLER=1 julia --threads=2 script.jl` and segfault. Reproduced across multiple systems. More impactful I would say, even in single-threaded mode, `PYTHONFAULTHANDLER=1` will crash the IJulia kernel any time you try to interrupt it. This is the situation I was in, I was on a cluster where the admins enabled this by default since its a really useful Python thing, and just lived without the ability to interrupt IJulia for months without knowing why, which I can attest *really sucks.*

Maybe it would make sense to unset this variable in `PyCall.__init__` and issue a warning that we're currently incompatible? I could submit a PR.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start at PyCall.__init__ and reproduce the supplied Julia MWE with and without PYTHONFAULTHANDLER=1. A complete change should address the reported Linux crashes, including interrupting an IJulia kernel, and verify the behavior on the affected setup.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
julia, python
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.