Crashes with Julia 1.12 and Revise.jl
评估
调研方向
首先复现 issue 中展示的使用 Revise 和 PyPlot 的 Julia REPL 操作序列。阅读 Revise 的 src/visit.jl 和 src/packagedef.jl,然后阅读 PyCall 中 pydecref 附近的 src/PyCall.jl,并将其与报告中的 Julia 1.12 和 Python 堆栈帧进行比较。当可复现的 segmentation fault 已被定位隔离,并且不再在所演示的设置中发生时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
I have been using PyPlot (with PyCall) with Revise.jl quite well in the past years, but after the upgrade to Julia 1.12 I see now constant crashes. I've tried to debug these, but they happen quite randomly. I was about to point the issue as happening only in IJulia kernels, when I started seeing them in Julia REPL as well.
These crashes can happen whenever, and are not related to calling "plot" functions.
I have tried reinstalling PyCall and PyPlot with ENV["PYTHON"] = "" (today) and verified the installation happens with a clean Conda.jl environment.
Here is an example of simple commands that trigger the crash:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.3 (2025-12-15)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org release
|__/ |
julia> using Base.Threads
julia> threadpool()
:interactive
julia> nthreads()
1
julia> Threads.nthreads(:default)
1
julia> using Revise
julia> using PyPlot
[857707] signal 11 (1): Segmentation fault
in expression starting at REPL[6]:1
_PyInterpreterState_GET at /usr/local/src/conda/python-3.12.12/Include/internal/pycore_pystate.h:133 [inlined]
notify_code_watchers at /usr/local/src/conda/python-3.12.12/Objects/codeobject.c:32
code_dealloc at /usr/local/src/conda/python-3.12.12/Objects/codeobject.c:1705
pydecref_ at /home/mazza/.julia/packages/PyCall/1gn3u/src/PyCall.jl:118 [inlined]
pydecref at /home/mazza/.julia/packages/PyCall/1gn3u/src/PyCall.jl:123
jfptr_pydecref_8808 at /home/mazza/.julia/compiled/v1.12/PyCall/GkzkC_o0cEr.so (unknown line)
run_finalizer at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/gc-common.c:180
jl_gc_run_finalizers_in_list at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/gc-common.c:270
run_finalizers at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/gc-common.c:316
ijl_gc_collect at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/gc-stock.c:3483
maybe_collect at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/gc-stock.c:349 [inlined]
ijl_gc_managed_malloc at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/gc-stock.c:3811
jl_alloc_genericmemory_unchecked at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/genericmemory.c:38
_new_genericmemory_ at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/genericmemory.c:68 [inlined]
jl_alloc_genericmemory at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/genericmemory.c:101
ijl_array_grow_end at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/array.c:222
_append_symbol_to_bindings_array at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/module.c:1958 [inlined]
append_module_names at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/module.c:1980
ijl_module_names at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/module.c:2001
#unsorted_names#4 at ./runtime_internals.jl:119 [inlined]
unsorted_names at ./runtime_internals.jl:119 [inlined]
#names#3 at ./runtime_internals.jl:118 [inlined]
names at ./runtime_internals.jl:118 [inlined]
_subtypes_in! at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/InteractiveUtils/src/InteractiveUtils.jl:266
subtypes at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/InteractiveUtils/src/InteractiveUtils.jl:303 [inlined]
_foreach_subtype! at /home/mazza/.julia/packages/Revise/icvyF/src/visit.jl:43
_foreach_subtype! at /home/mazza/.julia/packages/Revise/icvyF/src/visit.jl:49
_foreach_subtype! at /home/mazza/.julia/packages/Revise/icvyF/src/visit.jl:49
foreach_subtype at /home/mazza/.julia/packages/Revise/icvyF/src/visit.jl:38 [inlined]
#__init__##2 at /home/mazza/.julia/packages/Revise/icvyF/src/packagedef.jl:1658
unknown function (ip: 0x7f711c6a894f) at (unknown file)
jl_apply at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/julia.h:2391 [inlined]
start_task at /cache/build/tester-amdci4-9/julialang/julia-release-1-dot-12/src/task.c:1249
Allocations: 5202189 (Pool: 5202112; Big: 77); GC: 7
Segmentation fault (core dumped)
- 主要语言
- Julia
- 星标
- 1.5k
- 派生
- 186
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JuliaPy/PyCall.jl 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
Meta-Issue: Mutli-threading leads to segfaults可能已有人在做 @topolarity 于 210 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 20/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 25/100
查看 JuliaPy/PyCall.jl 的全部 Issue
相似的 Issue
-
found-by-agent
难度 2/5 1-3 小时 新手友好度 68/100
exanauts/SparseDirectSolver.jl#92 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
lu_instance/qr_instance run a full factorization for FixedSizeArrays可能已有人在做 @devmotion 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
JuliaArrays/ArrayInterface.jl#510 ·
-
Segfault on x86_64 with AVX: over-aligned vector store可能已有人在做 @vchuravy 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
EnzymeAD/Enzyme.jl#3775 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复