Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault with package, but not with identical module #554

Closed
kescobo opened this issue Sep 10, 2024 · 2 comments
Closed

Segfault with package, but not with identical module #554

kescobo opened this issue Sep 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@kescobo
Copy link

kescobo commented Sep 10, 2024

Affects: PythonCall

Describe the bug

I am attempting to build julia package that uses the python package girder_client. When trying to call a python function from within the package, I get a segfault. But when I run the code by itself, or define the same module in the REPL, I don't get the error.

Bare code - works

julia> using PythonCall

julia> girder_client = pyimport("girder_client")
Python: <module 'girder_client' from '/home/kevin/Repos/DigitalSlideArchive.jl/.CondaPkg/env/lib/python3.12/site-packages/girder_client/__init__.py'>

julia> gc = girder_client.GirderClient(; apiUrl=ENV["DSA_API_URL"])
Python: <girder_client.GirderClient object at 0x7f956b5e7b60>

REPL-defined (and include()) - works

julia> module Foo

       using PythonCall
       const girder_client = pyimport("girder_client")

       end
Main.Foo

julia> gc = Foo.girder_client.GirderClient(; apiUrl=ENV["DSA_API_URL"])
Python: <girder_client.GirderClient object at 0x7f72737c4200>
shell> cat src/DigitalSlideArchive.jl
module DigitalSlideArchive

using PythonCall
const girder_client = pyimport("girder_client")

end

julia> include("src/DigitalSlideArchive.jl")
Main.DigitalSlideArchive

julia> gc = DigitalSlideArchive.girder_client.GirderClient(ENV["DSA_API_URL"])
Python: <girder_client.GirderClient object at 0x7f8e1cbc41a0>

Package version (doesn't work):

julia> using DigitalSlideArchive

julia> gc = DigitalSlideArchive.girder_client.GirderClient(ENV["DSA_API_URL"])

[265486] signal 11 (1): Segmentation fault
julia> versioninfo()
Julia Version 1.11.0-rc3
Commit 616e45539db (2024-08-26 15:46 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver4)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
  JULIA_PROJECT = /home/kevin/Repos/DigitalSlideArchive.jl
  JULIA_EDITOR = nvim

(DigitalSlideArchive) pkg> st
Project DigitalSlideArchive v0.1.0
Status `~/Repos/DigitalSlideArchive.jl/Project.toml`
  [992eb4ea] CondaPkg v0.2.23
  [6099a3de] PythonCall v0.9.23

(DigitalSlideArchive) pkg> conda st
CondaPkg Status /home/kevin/Repos/DigitalSlideArchive.jl/CondaPkg.toml
Environment
  /home/kevin/Repos/DigitalSlideArchive.jl/.CondaPkg/env
Pip packages
  girder-client v3.2.3
full segfault

julia> gc = DigitalSlideArchive.girder_client.GirderClient(ENV["DSA_API_URL"])

[265486] signal 11 (1): Segmentation fault
in expression starting at REPL[2]:1
Py_TYPE at /usr/local/src/conda/python-3.12.5/Include/object.h:220 [inlined]
PyObject_GetAttr at /usr/local/src/conda/python-3.12.5/Objects/object.c:1034
PyObject_GetAttr at /home/kevin/.julia/packages/PythonCall/Nr75f/src/C/pointers.jl:303 [inlined]
macro expansion at /home/kevin/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:132 [inlined]
pygetattr at /home/kevin/.julia/packages/PythonCall/Nr75f/src/Core/builtins.jl:62
getproperty at /home/kevin/.julia/packages/PythonCall/Nr75f/src/Core/Py.jl:273
unknown function (ip: 0x7f0341939f86)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
do_call at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:126
eval_value at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:223
eval_stmt_value at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:174 [inlined]
eval_body at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:663
jl_interpret_toplevel_thunk at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:821
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:943
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:886
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:886
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:886
ijl_toplevel_eval_in at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:994
eval at ./boot.jl:430 [inlined]
eval_user_input at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:226
repl_backend_loop at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:323
#start_repl_backend#59 at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:308
start_repl_backend at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:305
#run_repl#72 at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:464
run_repl at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:450
jfptr_run_repl_11642 at /home/kevin/Dotfiles/.julia/juliaup/julia-1.11.0-rc3+0.x64.linux.gnu/share/julia/compiled/v1.11/REPL/u0gqU_5pcrL.so (unknown line)
#1137 at ./client.jl:441
jfptr_YY.1137_16382 at /home/kevin/Dotfiles/.julia/juliaup/julia-1.11.0-rc3+0.x64.linux.gnu/share/julia/compiled/v1.11/REPL/u0gqU_5pcrL.so (unknown line)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_f__call_latest at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/builtins.c:875
#invokelatest#2 at ./essentials.jl:1054 [inlined]
invokelatest at ./essentials.jl:1051 [inlined]
run_main_repl at ./client.jl:425
repl_main at ./client.jl:562 [inlined]
_start at ./client.jl:536
jfptr__start_71892.1 at /home/kevin/Dotfiles/.julia/juliaup/julia-1.11.0-rc3+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
true_main at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jlapi.c:900
jl_repl_entrypoint at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jlapi.c:1059
main at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/cli/loader_exe.c:58
__libc_start_call_main at /lib64/libc.so.6 (unknown line)
__libc_start_main at /lib64/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)
Allocations: 2719857 (Pool: 2719703; Big: 154); GC: 4
fish: Job 1, 'julia -q' terminated by signal SIGSEGV (Address boundary error)
```

</p>
</details> 
@kescobo kescobo added the bug Something isn't working label Sep 10, 2024
@cjdoris
Copy link
Collaborator

cjdoris commented Sep 10, 2024

@kescobo
Copy link
Author

kescobo commented Sep 10, 2024

Ahh, that's very clear. Sorry I missed that!

@kescobo kescobo closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants