JuliaPy / JuliaPy/PythonCall.jl

at_jl_exit sometimes crashes

未关闭
#764 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

**Affects:** JuliaCall

**Describe the bug**
When running multithreaded julia, python sometimes causes segmentation fault at exit.

**Your system**
Please provide detailed information about your system:
- Ubuntu 25.10
- Julia 1.12.6, Python 3.14.4, PythonCall 0.9.31, JuliaCall 0.9.31

**Additional context**

jl_atexit_hook(0) does three things in sequence:

1. Run user atexit hooks (Base._atexit(0)).
2. Schedule + run ALL registered finalizers (jl_gc_run_all_finalizers).
3. Tear down threads, set jl_gc_disable_counter = 1.

Finalizers are best-effort, and running them during shutdown with multiple threads is probably where the crashes come from. Since the process is exiting, the finalizers don't semantically need to run — they're unsafe and not useful.
I tested that with only `Base._atexit(0), my custom julia `atexit` lambdas are executed

Fixed by https://github.com/JuliaPy/PythonCall.jl/pull/763

贡献指南

这个仓库没有索引到贡献指南

调研方向

Review jl_atexit_hook(0), Base._atexit(0), and jl_gc_run_all_finalizers to understand the shutdown sequence described in the report. Compare the behavior and available tests with the fix in PythonCall.jl pull request 763; this issue is already marked as fixed there.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, python
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
10/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。