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

using PyCall triggers segfault in unrelated threaded code #723

Closed
marius311 opened this issue Oct 31, 2019 · 1 comment
Closed

using PyCall triggers segfault in unrelated threaded code #723

marius311 opened this issue Oct 31, 2019 · 1 comment

Comments

@marius311
Copy link
Contributor

marius311 commented Oct 31, 2019

I have some code on Julia 1.3-rc4 that uses threads and does not use PyCall. I can run said code fine with JULIA_NUM_THREADS set to any number. However, if I do a using PyCall before running it, despite that this code ostensibly does not call into PyCall at all, it triggers a segfault whenever I have JULIA_NUM_THREADS set to 2 or more (although its fine with 1).

The error I get looks like:

julia> unrelated_code()
Fatal Python error: Segmentation fault

Thread 0x00002aaaaaae22c0 (most recent call first):

signal (11): Segmentation fault
in expression starting at REPL[5]:1
Segmentation fault

Here's the output I get from gdb.

Thread 3 "julia-debug" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaabda24700 (LWP 9749)]
0x00002aaaaadb02fb in jl_gc_safepoint () at /global/u1/m/marius/src/julia-1.3/src/jlapi.c:432
432         jl_gc_safepoint_(ptls);
(gdb) bt
#0  0x00002aaaaadb02fb in jl_gc_safepoint () at /global/u1/m/marius/src/julia-1.3/src/jlapi.c:432
#1  0x00002aaaaad99ddc in get_next_task (getsticky=0x2aaab87000d0) at /global/u1/m/marius/src/julia-1.3/src/partr.c:378
#2  0x00002aaaaad99ef5 in jl_task_get_next (getsticky=0x2aaab87000d0) at /global/u1/m/marius/src/julia-1.3/src/partr.c:403
#3  0x00002aaab03355fe in japi1_poptaskref_2219 (W=...) at task.jl:660
#4  0x00002aaab033603d in julia_wait_2217 () at task.jl:667
#5  0x00002aaabeae4de8 in japi1_task_done_hook_17285 (t=...) at task.jl:401
#6  0x00002aaaaad413d7 in jl_fptr_args (f=0x2aaab1aa9f70 <jl_system_image_data+13360560>, args=0x2aac48bffd88, nargs=1, m=0x2aaaba166ef0)
    at /global/u1/m/marius/src/julia-1.3/src/gf.c:1910
#7  0x00002aaaaad42070 in _jl_invoke (F=0x2aaab1aa9f70 <jl_system_image_data+13360560>, args=0x2aac48bffd88, nargs=1, mfunc=0x2aaab1aa9c30 <jl_system_image_data+13359728>, 
    world=26805) at /global/u1/m/marius/src/julia-1.3/src/gf.c:2130
#8  0x00002aaaaad42827 in jl_apply_generic (F=0x2aaab1aa9f70 <jl_system_image_data+13360560>, args=0x2aac48bffd88, nargs=1) at /global/u1/m/marius/src/julia-1.3/src/gf.c:2300
#9  0x00002aaaaad61333 in jl_apply (args=0x2aac48bffd80, nargs=2) at /global/u1/m/marius/src/julia-1.3/src/julia.h:1631
#10 0x00002aaaaad61b04 in jl_finish_task (t=0x2aaab87db0d0, resultval=0x2aaab0df0600 <jl_system_image_data+17472>) at /global/u1/m/marius/src/julia-1.3/src/task.c:181
#11 0x00002aaaaad62de6 in start_task () at /global/u1/m/marius/src/julia-1.3/src/task.c:669
#12 0x0000000000000000 in ?? ()
Backtrace stopped: Cannot access memory at address 0x2aac48c00000

Its 100% reproducible on this system, although not on others. The version of Python is 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:10:26) \n[GCC 7.3.0] and PyCall is either 1.91.2 or master.

Any suggestions tracking this down further, or what I can do to fix it? Thanks.

Edit: Changed gdb output to use julia-debug.

@marius311
Copy link
Contributor Author

I can't really reproduce this anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant