Skip to content

segfault when using any package that uses PyCall #89

Closed

Description

@ExpandingMan

I'm getting segfaults that seem to be occurring if and only if I attempt to use a Julia package that itself uses PyCall. It may seem un-intuitive that someone would want to do this at all, but some packages use PyCall for a few incidental things, but may be mostly Julia code (and not python wrappers). Using Python 3.5 and PyCall 1.11.0 on Ubuntu 16.04.

signal (11): Segmentation fault
while loading /home/user/.julia/v0.5/ScikitLearn/src/Skcore.jl, in expression starting on line 9
PyEval_GetFrame at /usr/bin/python3 (unknown line)
PyEval_GetGlobals at /usr/bin/python3 (unknown line)
PyImport_Import at /usr/bin/python3 (unknown line)
PyImport_ImportModule at /usr/bin/python3 (unknown line)
macro expansion at /home/user/.julia/v0.5/PyCall/src/exception.jl:78 [inlined]
pyimport at /home/user/.julia/v0.5/PyCall/src/PyCall.jl:392
__init__ at /home/user/.julia/v0.5/PyCall/src/pyinit.jl:58
unknown function (ip: 0x7f6085a2fece)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1392 [inlined]
jl_module_run_initializer at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:83
jl_init_restored_modules at /home/centos/buildbot/slave/package_tarball64/build/src/dump.c:2093 [inlined]
_jl_restore_incremental at /home/centos/buildbot/slave/package_tarball64/build/src/dump.c:2742
_jl_restore_incremental at /home/centos/buildbot/slave/package_tarball64/build/src/dump.c:2674 [inlined]
jl_restore_incremental at /home/centos/buildbot/slave/package_tarball64/build/src/dump.c:2762
_include_from_serialized at ./loading.jl:150
_require_from_serialized at ./loading.jl:187
_require_search_from_serialized at ./loading.jl:217
unknown function (ip: 0x7f62a00e5b80)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
require at ./loading.jl:371
unknown function (ip: 0x7f629ffb84ab)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1392 [inlined]
eval_import_path_ at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:402
eval_import_path at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:429 [inlined]
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:480
jl_eval_module_expr at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:196
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:465
jl_parse_eval_all at /home/centos/buildbot/slave/package_tarball64/build/src/ast.c:717
jl_load at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:596
jl_load_ at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:605
include_from_node1 at ./loading.jl:488
unknown function (ip: 0x7f629ff7da2b)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
do_call at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:66
eval at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:190
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:558
jl_eval_module_expr at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:196
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:465
jl_parse_eval_all at /home/centos/buildbot/slave/package_tarball64/build/src/ast.c:717
jl_load at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:596
jl_load_ at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:605
include_from_node1 at ./loading.jl:488
jl_load_ at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:605                                                                                                      [0/817]
include_from_node1 at ./loading.jl:488
unknown function (ip: 0x7f629ff7da2b)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
do_call at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:66
eval at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:190
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:558 [inlined]
jl_toplevel_eval at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:580
jl_toplevel_eval_in_warn at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:590
macro expansion; at ./none:2 [inlined]
anonymous at ./<missing> (unknown line)
unknown function (ip: 0x7f60859db681)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:569 [inlined]
jl_toplevel_eval at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:580
jl_toplevel_eval_in_warn at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:590
eval at ./boot.jl:234
unknown function (ip: 0x7f629ff6929f)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
process_options at ./client.jl:242
_start at ./client.jl:321
unknown function (ip: 0x7f629ffa2bd8)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
ffi_call_unix64 at /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so (unknown line)
ffi_call at /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so (unknown line)
_ctypes_callproc at /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so (unknown line)
unknown function (ip: 0x7f62a4bc5fca)
PyObject_Call at /usr/bin/python3 (unknown line)
PyEval_EvalFrameEx at /usr/bin/python3 (unknown line)
unknown function (ip: 0x523de6)
PyEval_EvalCode at /usr/bin/python3 (unknown line)
unknown function (ip: 0x5fd5f1)
PyRun_FileExFlags at /usr/bin/python3 (unknown line)
PyRun_SimpleFileExFlags at /usr/bin/python3 (unknown line)
Py_Main at /usr/bin/python3 (unknown line)
main at /usr/bin/python3 (unknown line)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at /usr/bin/python3 (unknown line)
Allocations: 2252490 (Pool: 2251561; Big: 929); GC: 1
ErrorException("Failed to precompile ScikitLearn to /home/user/.julia/lib/pyjulia3-v0.5/ScikitLearn.ji.")Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/pyjulia/julia/julia/core.py", line 447, in using
    self.eval("using %s" % module)
  File "/home/user/pyjulia/julia/julia/core.py", line 429, in eval
    ans = self._call(src)
  File "/home/user/pyjulia/julia/julia/core.py", line 392, in _call
    self.check_exception(src)
  File "/home/user/pyjulia/julia/julia/core.py", line 412, in check_exception
    .format(exception_type, src))
julia.core.JuliaError: Exception 'ErrorException' occurred while calling julia code:
using ScikitLearn

By the way, I have no idea what all the /home/centos stuff is. This is not centos, and even if it were, why would there be a directory in /home called centos?

Activity

  1. stevengj commented on Mar 16, 2017

    @stevengj
    Member

    The centos stuff refers to the machine where julia was built, presumably.

  2. stevengj commented on Mar 16, 2017

    @stevengj
    Member

    When you use PyCall from Julia, is PyCall.python the same as the Python executable you are running pyjulia from?

    Alternatively, if you are using a statically linked Python, then pyjulia uses a custom-precompiled version of PyCall. That could be screwing up the loading of a precompiled version of another module that was using the "ordinary" precompiled PyCall. A workaround might be to delete all the .ji files in ~/.julia/lib/v0.5/ to force it to recompile the cache from pyjulia.

  3. ExpandingMan commented on Mar 17, 2017

    @ExpandingMan
    Author

    Yes, PyCall points to the same executable that I'm running pyjulia from. Is that an issue? I'd have thought they could just open separate instances of it.

    Forgive my ignorance, but I'm not entirely sure what is meant by a "statically linked Python". Actually I'd have thought much of what python is doing is coming from dynamically linked libraries, but I really have no idea (except for the case of python packages some of which I know have their own .sos).

    Anyway, deleting the Julia binaries for only the package that uses PyCall, or for both that package and PyCall do not seem to work. It's possible that one of them has dependencies I'd have to delete also.

  4. stevengj commented on Mar 17, 2017

    @stevengj
    Member

    Yes, PyCall points to the same executable that I'm running pyjulia from. Is that an issue? I'd have thought they could just open separate instances of it.

    No, that is correct. (PyCall doesn't actually launch the python executable, it links to the Python library. I wanted to make sure it was configured consistent with the Python you are using.)

  5. Keno commented on Jul 28, 2017

    @Keno
    Contributor

    Can you try this again with latest PyCall and pyjulia. The fixes in #110 and to pycall symbol resolution may have fixed this.

  6. Keno commented on Aug 18, 2017

    @Keno
    Contributor

    I was able to reproduce another segfault here, but I think I managed to fix it in 6ba2f22. If things are still broken, we'll need a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions