JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.46k stars 187 forks source link

Github action crashing due to PyCall in finalizer #959

Open IanButterworth opened 2 years ago

IanButterworth commented 2 years ago

I have tests for a package that uses PyPlot that appears to be crashing during finalizers, after the package tests have completed

The odd thing is this action is built with PYTHON="" and PyCall claims to be using the correct julia-provided python, but the crash is happening with the github action-provided python? I was getting confused by the baked-in build paths from the feedstock-built python

julia 1.6.5 with

  [438e738f] PyCall v1.93.0
  [d330b81b] PyPlot v2.10.0

The userspace is my name because this is a self-hosted runner.

Testing Running tests...
PyPlot.PyCall.pyversion = v"3.9.7"
PyPlot.PyCall.libpython = "/home/ian/.julia/conda/3/lib/libpython3.9.so.1.0"
Test Summary: | Pass  Total
Foo           |   44     44

signal (11): Segmentation fault
in expression starting at none:0
PyErr_Occurred at /home/conda/feedstock_root/build_artifacts/python-split_1632942464411/work/Python/errors.c:253
find_name_in_mro at /home/conda/feedstock_root/build_artifacts/python-split_1632942464411/work/Objects/typeobject.c:3221 [inlined]
_PyType_Lookup at /home/conda/feedstock_root/build_artifacts/python-split_1632942464411/work/Objects/typeobject.c:3258 [inlined]
_PyType_Lookup at /home/conda/feedstock_root/build_artifacts/python-split_1632942464411/work/Objects/typeobject.c:3235
_PyObject_GenericGetAttrWithDict at /home/conda/feedstock_root/build_artifacts/python-split_1632942464411/work/Objects/object.c:1194
module_getattro at /home/conda/feedstock_root/build_artifacts/python-split_1632942464411/work/Objects/moduleobject.c:717
PyObject_GetAttrString at /home/conda/feedstock_root/build_artifacts/python-split_1632942464411/work/Objects/object.c:795
_getproperty at /home/ian/.julia/packages/PyCall/L0fLP/src/PyCall.jl:300
__getproperty at /home/ian/.julia/packages/PyCall/L0fLP/src/PyCall.jl:306 [inlined]
getproperty at /home/ian/.julia/packages/PyCall/L0fLP/src/PyCall.jl:311 [inlined]
#7 at /home/ian/.julia/packages/PyCall/L0fLP/src/gui.jl:200
macro expansion at ./asyncevent.jl:256 [inlined]
#583 at ./task.jl:411
unknown function (ip: 0x7f7d31b9f87c)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:834
Allocations: 4907320277 (Pool: 4906960673; Big: 359604); GC: 2763
ERROR: Package Foo errored during testing (received signal: 11)
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:55
 [2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing)
   @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1694
 [3] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Vector{String}, test_args::Cmd, kwargs::Base.Iterators.Pairs{Symbol, IOContext{Base.PipeEndpoint}, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IOContext{Base.PipeEndpoint}}}})
   @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:343
 [4] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{Base.PipeEndpoint}, kwargs::Base.Iterators.Pairs{Symbol, Vector{String}, Tuple{Symbol}, NamedTuple{(:julia_args,), Tuple{Vector{String}}}})
   @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:80
 [5] test(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Iterators.Pairs{Symbol, Vector{String}, Tuple{Symbol}, NamedTuple{(:julia_args,), Tuple{Vector{String}}}})
   @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:96
 [6] top-level scope
   @ none:1