Skip to content

Segfault when calling Python function repeatedly. #731

Description

@thirtysixbananas

Affects: PythonCall

I call a Python function in a loop. Most of the time all good, but some times crashes.

I will try and create an MWE soon.

[832110] signal 11 (1): Segmentation fault
in expression starting at /home/cakeduke/<path>
unknown function (ip: 0x7f972e778b30) at /usr/lib/x86_64-linux-gnu/libpython3.13.so.1.0
pydecref_ at /home/cakeduke/.julia/packages/PyCall/1gn3u/src/PyCall.jl:118 [inlined]                                                            pydecref at /home/cakeduke/.julia/packages/PyCall/1gn3u/src/PyCall.jl:123
jfptr_pydecref_8286 at /home/cakeduke/.julia/compiled/v1.12/PyCall/GkzkC_MLBTq.so (unknown line)
run_finalizer at /cache/build/builder-amdci5-2/julialang/julia-release-1-dot-12/src/gc-common.c:180
jl_gc_run_finalizers_in_list at /cache/build/builder-amdci5-2/julialang/julia-release-1-dot-12/src/gc-common.c:270
run_finalizers at /cache/build/builder-amdci5-2/julialang/julia-release-1-dot-12/src/gc-common.c:316
enable_finalizers at ./gcutils.jl:161 [inlined]
unlock at ./locks-mt.jl:68 [inlined]
multiq_deletemin at ./partr.jl:212
trypoptask at ./task.jl:1208
jfptr_trypoptask_1822.1 at /home/cakeduke/julia-1.12.2/lib/julia/sys.so (unknown line)
get_next_task at /cache/build/builder-amdci5-2/julialang/julia-release-1-dot-12/src/scheduler.c:309 [inlined]
ijl_task_get_next at /cache/build/builder-amdci5-2/julialang/julia-release-1-dot-12/src/scheduler.c:371

PyCall v1.96.4
Julia 1.12.2
Python 3.13.5 (This is the OS python, I'm unsure what PyCall actually uses)
CondaPkg not installed.

julia> versioninfo()
Julia Version 1.12.2
Commit ca9b6662be4 (2025-11-20 16:25 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, skylake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_PKG_USE_CLI_GIT = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions