JuliaPy / JuliaPy/PyCall.jl

importing inspect causes segfault

Open
#604 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

I can use `@pyimport` on most modules without difficulty, but trying it on inspect causes a segfault:

```
---(Many, many, repeats of the following error)---
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
convert at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:607
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
convert at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:849
iterate at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:574
copy at ./abstractdict.jl:152
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
convert at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:607
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
convert at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:849
iterate at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:574
copy at ./abstractdict.jl:152
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
convert at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:607
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
convert at /home/glynch/.julia/packages/PyCall/0jMpb/src/conversions.jl:849
#75 at ./none:0
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
iterate at ./generator.jl:47 [inlined]
collect_to! at ./array.jl:656
collect_to_with_first! at ./array.jl:643 [inlined]
collect at ./array.jl:624
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
pywrap at /home/glynch/.julia/packages/PyCall/0jMpb/src/PyCall.jl:342
pywrap at /home/glynch/.julia/packages/PyCall/0jMpb/src/PyCall.jl:338
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:324
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:430
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:363 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:682
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:795
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7fd29333540f)
unknown function (ip: 0x4)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:804
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:813
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/builtins.c:622
eval at ./boot.jl:319
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1537 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:268
unknown function (ip: 0xffffffffffffffff)
Allocations: 31054891 (Pool: 31039570; Big: 15321); GC: 46
[1] 6686 segmentation fault (core dumped) julia1
```
It only segfaults after some time. Given the recursive nature of the error message and the time it takes to trigger a segfault I'm guessing that the import causes some sort of infinite loop?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with @pyimport inspect and read the recursive conversion paths in src/conversions.jl, especially around lines 574, 607, and 849, along with pywrap in src/PyCall.jl around lines 338-342. Determine why importing inspect repeatedly enters those conversion paths; done means the import completes without a segmentation fault and the regression is covered by a reproducible check.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.