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

embedding crash (?) on Windows #22320

Closed
ihnorton opened this issue Jun 10, 2017 · 5 comments · Fixed by #22254
Closed

embedding crash (?) on Windows #22320

ihnorton opened this issue Jun 10, 2017 · 5 comments · Fixed by #22254
Labels
embedding Embedding Julia using the C API regression Regression in behavior compared to a previous version system:windows Affects only Windows

Comments

@ihnorton
Copy link
Member

The following python code, run in the bin/ install directory, exits on both win32 and win64 in 0.6-rc3. (works ok in 0.5.2 when jl_init signature is adjusted accordingly)

from cffi import FFI
ffi = FFI()
ffi.cdef("void jl_init();")
c = ffi.dlopen("libjulia.dll")
c.jl_init()

I looked at a backtrace in windbg on win32 and saw a stackoverflow (jl_array_to_string I think), but the vm timed out.

ref: https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180

@ihnorton ihnorton added the embedding Embedding Julia using the C API label Jun 10, 2017
@ihnorton
Copy link
Member Author

I confirmed the stack overflow from C(++), compiled with MSVC. The strange thing is that the top of the stack is the same when running under gdb (identical path passed to jl_restore_system_image):

Top of stack (the crash is usually ingc_pool_alloc):

Breakpoint 6, jl_deserialize_value (s=0x99ce9ef6f0, loc=0x0) at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1549
warning: Source file is more recent than executable.
1549    {
(gdb) up
#1  0x000000006f7c11c7 in jl_restore_system_image_from_stream (f=0x99ce9ef780)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2616
2616        jl_main_module = (jl_module_t*)jl_deserialize_value(&s, NULL);
(gdb)
#2  0x000000006f7c1743 in jl_restore_system_image_data (buf=0x6aa34350 <jl_system_image_data> "", len=26698816)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2704
2704        jl_restore_system_image_from_stream(&f);
(gdb)
#3  0x000000006f7b857b in jl_load_sysimg_so () at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:284
284         jl_restore_system_image_data(sysimg_data, len);
(gdb)
#4  0x000000006f7c1628 in jl_restore_system_image (fname=0x24f58a52cc0 "C:\\opt\\Julia-0.7.0-DEV\\lib\\julia\\sys-debug.dll")
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2686
2686            jl_load_sysimg_so();
(gdb)
#5  0x000000006f7b04a7 in _julia_init (rel=JL_IMAGE_JULIA_HOME) at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/init.c:679
warning: Source file is more recent than executable.
679                 jl_restore_system_image(jl_options.image_file);
(gdb) dis 6
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x000000006f89d4ea in memhash (buf=0x99ce8f41d0 "C_Sparse", n=8) at hashing.c:61
61      hashing.c: No such file or directory.

The bottom of the stack:

#0  0x000000006f89d4ea in memhash (buf=0x99ce8f41d0 "C_Sparse", n=8) at hashing.c:61
#1  0x000000006f7ac1dd in hash_symbol (str=0x99ce8f41d0 "C_Sparse", len=8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/symbol.c:22
#2  0x000000006f7ac393 in symtab_lookup (ptree=0x6faa96f0 <symtab>, str=0x99ce8f41d0 "C_Sparse", len=8, slot=0x99ce8f4138)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/symbol.c:49
#3  0x000000006f7ac4c5 in _jl_symbol (str=0x99ce8f41d0 "C_Sparse", len=8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/symbol.c:76
#4  0x000000006f7ac5a4 in jl_symbol (str=0x99ce8f41d0 "C_Sparse")
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/symbol.c:93
#5  0x000000006f7bd670 in jl_deserialize_value_symbol (s=0x99ce9ef6f0, vtag=0x24f593d00d0)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1626
#6  0x000000006f7bf1e9 in jl_deserialize_value_ (s=0x99ce9ef6f0, vtag=0x24f593d00d0, loc=0x24f594d1eb0)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2061
#7  0x000000006f7bd43e in jl_deserialize_value (s=0x99ce9ef6f0, loc=0x24f594d1eb0)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1587
#8  0x000000006f7beb6e in jl_deserialize_struct (s=0x99ce9ef6f0, v=0x24f594d1eb0, startfield=0)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1955
#9  0x000000006f7bf0fb in jl_deserialize_value_any (s=0x99ce9ef6f0, vtag=0x1c, loc=0x24f594dd030)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2044
#10 0x000000006f7bf658 in jl_deserialize_value_ (s=0x99ce9ef6f0, vtag=0x1c, loc=0x24f594dd030)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2140
#11 0x000000006f7bd43e in jl_deserialize_value (s=0x99ce9ef6f0, loc=0x24f594dd030)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1587
#12 0x000000006f7bd0a7 in jl_deserialize_datatype (s=0x99ce9ef6f0, pos=9492, loc=0x24f594d51f8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1535
#13 0x000000006f7bee7d in jl_deserialize_value_any (s=0x99ce9ef6f0, vtag=0x1c, loc=0x24f594d51f8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2010
#14 0x000000006f7bf658 in jl_deserialize_value_ (s=0x99ce9ef6f0, vtag=0x1c, loc=0x24f594d51f8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2140
#15 0x000000006f7bd43e in jl_deserialize_value (s=0x99ce9ef6f0, loc=0x24f594d51f8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1587
#16 0x000000006f7bd549 in jl_deserialize_value_svec (s=0x99ce9ef6f0, vtag=0x24f593d0130)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1604
#17 0x000000006f7bf182 in jl_deserialize_value_ (s=0x99ce9ef6f0, vtag=0x24f593d0130, loc=0x24f594dcfe0)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2054
#18 0x000000006f7bd43e in jl_deserialize_value (s=0x99ce9ef6f0, loc=0x24f594dcfe0)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1587
#19 0x000000006f7bd0d8 in jl_deserialize_datatype (s=0x99ce9ef6f0, pos=9490, loc=0x24f594d51d8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1537
#20 0x000000006f7bee7d in jl_deserialize_value_any (s=0x99ce9ef6f0, vtag=0x1c, loc=0x24f594d51d8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2010
#21 0x000000006f7bf658 in jl_deserialize_value_ (s=0x99ce9ef6f0, vtag=0x1c, loc=0x24f594d51d8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:2140
#22 0x000000006f7bd43e in jl_deserialize_value (s=0x99ce9ef6f0, loc=0x24f594d51d8)
    at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/dump.c:1587

@ihnorton ihnorton added the regression Regression in behavior compared to a previous version label Jun 12, 2017
@ihnorton
Copy link
Member Author

Looks vaguely like #19199...

@ihnorton ihnorton added the system:windows Affects only Windows label Jun 12, 2017
@ihnorton
Copy link
Member Author

Well, that's exactly the problem. Works fine when compiled with /Stack:8000000 😢

@vtjnash
Copy link
Member

vtjnash commented Jun 12, 2017

Yep, should be fixed by #22254

@ihnorton
Copy link
Member Author

Can that be back-ported, or is there anything else we can do about the 7MB stack requirement for 0.6?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedding Embedding Julia using the C API regression Regression in behavior compared to a previous version system:windows Affects only Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants