Open nhz2 opened 1 month ago
I have a very similar issue with the final julia 1.11.0. The segfault is very non-deterministic. It doesn't always happen and when it happens it doesn't always happen at the same point. Some backtraces look like this:
[36693] signal 11 (1): Segmentation fault
in expression starting at [REDACTED].jl
PyType_IsSubtype at /usr/lib64/libpython3.12.so.1.0 (unknown line)
unknown function (ip: 0x7fb959cbaf3d)
_PyEval_EvalFrameDefault at /usr/lib64/libpython3.12.so.1.0 (unknown line)
unknown function (ip: 0x7fb959cdce0a)
PyObject_CallObject at $HOME/.julia/packages/PythonCall/Nr75f/src/C/pointers.jl:303 [inlined]
macro expansion at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:132 [inlined]
pycallargs at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/builtins.jl:220
#pycall#21 at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/builtins.jl:243 [inlined]
pycall at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/builtins.jl:233 [inlined]
#_#11 at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:357 [inlined]
Py at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:357 [inlined]
[...]
Others like this:
[36447] signal 11 (1): Segmentation fault
in expression starting at [REDACTED].jl
PyObject_GetAttr at /usr/lib64/libpython3.12.so.1.0 (unknown line)
PyUFuncOverride_GetNonDefaultArrayUfunc at [REDACTED]/.venv/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-x86_64-linux-gnu.so (unknown line)
PyUFunc_CheckOverride at [REDACTED]/.venv/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-x86_64-linux-gnu.so (unknown line)
ufunc_generic_fastcall at [REDACTED]/.venv/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-x86_64-linux-gnu.so (unknown line)
PyObject_Vectorcall at /usr/lib64/libpython3.12.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /usr/lib64/libpython3.12.so.1.0 (unknown line)
unknown function (ip: 0x7f829fedce0a)
PyObject_CallObject at $HOME/.julia/packages/PythonCall/Nr75f/src/C/pointers.jl:303 [inlined]
macro expansion at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:132 [inlined]
pycallargs at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/builtins.jl:220
#pycall#21 at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/builtins.jl:243 [inlined]
pycall at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/builtins.jl:233 [inlined]
#_#11 at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:357 [inlined]
Py at $HOME/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:357 [inlined]
[...]
Running the same code with julia 1.10.4 doesn't have this issue.
I also get seg faults, on linux, only on multithread, in applications which worked with julia 1.10
Fwiw, here's a somewhat self-contained example that reliably crashes for me within a handful of runs (but it's non-deterministic), see this repository. Its only dependencies are QuadGK
on the julia side and camb
on the python side. The crashes only happen with julia 1.11, not with julia 1.10. This is on x86_64 Linux.
import QuadGK
using PythonCall
const camb = pyimport("camb")
const Pm = let
params = camb.set_params(H0=70)
params.set_matter_power(redshifts=0:.1:1.5, kmax=9.5)
res = camb.get_results(params)
power = res.get_matter_power_interpolator(nonlinear=false, k_hunit=false, hubble_units=false, extrap_kmax=1e6).P
(z, k) -> let
pyval = power(z, k)
pyconvert(Float64, pyval)
end
end
calculate_stuff = (R, z) -> let
θ = R/900.
integrand = lθ -> let
kl = lθ/((1+z) * R)
sqrt(lθ)*cos(lθ)*Pm(z, kl) / (θ*θ)
end
QuadGK.quadgk(integrand, 0, 50)[1]
end
zvalues = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7]
Rvalues = collect(.1:.2:7.0)
@info @. calculate_stuff(Rvalues, zvalues')
Affects: PythonCall
Describe the bug I got a segfault using PythonCall on GitHub CI for Apple M1.
https://github.com/JuliaIO/ZipArchives.jl/actions/runs/11219970406/job/31187122812?pr=82
This seems to be an intermittent issue. Your system
Additional context
Stack trace: