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

segfault on Python 3.5 #66

Closed
ExpandingMan opened this issue Oct 6, 2016 · 8 comments
Closed

segfault on Python 3.5 #66

ExpandingMan opened this issue Oct 6, 2016 · 8 comments

Comments

@ExpandingMan
Copy link

I get the following segfault when I do j = julia.Julia() on Python 3.5.

WARNING: redefining constant JULIA_HOME
InitError(:PyCall,PyError (:PyImport_ImportModule) <class 'SystemError'>
SystemError('initialization of _opcode did not return an extension module',)

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
PyObject_Call at /usr/bin/../lib/x86_64-linux-gnu/libpython3.5m.so (unknown line)
macro expansion at /home/savastio/.julia/v0.5/PyCall/src/exception.jl:78 [inlined]
#_pycall#62 at /home/savastio/.julia/v0.5/PyCall/src/PyCall.jl:546
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
jl_apply at /build/julia-0ecDfF/julia-0.5.0/src/julia.h:1392 [inlined]
jl_f__apply at /build/julia-0ecDfF/julia-0.5.0/src/builtins.c:547
_pycall at /home/savastio/.julia/v0.5/PyCall/src/PyCall.jl:534
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
jl_apply at /build/julia-0ecDfF/julia-0.5.0/src/julia.h:1392 [inlined]
jl_f__apply at /build/julia-0ecDfF/julia-0.5.0/src/builtins.c:547
#pycall#65 at /home/savastio/.julia/v0.5/PyCall/src/PyCall.jl:565
show at /home/savastio/.julia/v0.5/PyCall/src/exception.jl:39
unknown function (ip: 0x7f7f98d931f6)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
show_default at ./show.jl:130
unknown function (ip: 0x7f7f98d91c06)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
show at ./show.jl:116
unknown function (ip: 0x7f7f98d91686)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
jl_apply at /build/julia-0ecDfF/julia-0.5.0/src/julia.h:1392 [inlined]
jl_show at /build/julia-0ecDfF/julia-0.5.0/src/builtins.c:972
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: 0x7f81dfd4cfca)
PyObject_Call at python3 (unknown line)
PyEval_EvalFrameEx at python3 (unknown line)
unknown function (ip: 0x523de6)
PyEval_EvalFrameEx at python3 (unknown line)
PyEval_EvalFrameEx at python3 (unknown line)
PyEval_EvalCodeEx at python3 (unknown line)
unknown function (ip: 0x4e3827)
PyObject_Call at python3 (unknown line)
unknown function (ip: 0x4f498d)
PyObject_Call at python3 (unknown line)
unknown function (ip: 0x54e948)
unknown function (ip: 0x5586ab)
PyObject_Call at python3 (unknown line)
PyEval_EvalFrameEx at python3 (unknown line)
unknown function (ip: 0x523de6)
PyEval_EvalCode at python3 (unknown line)
unknown function (ip: 0x5fd5f1)
PyRun_InteractiveOneObject at python3 (unknown line)
PyRun_InteractiveLoopFlags at python3 (unknown line)
unknown function (ip: 0x458aef)
unknown function (ip: 0x4cf513)
main at python3 (unknown line)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at python3 (unknown line)
Allocations: 2217234 (Pool: 2216298; Big: 936); GC: 1
[1]    89582 segmentation fault (core dumped)  python3

My PyCall package has been successfully compiled for Python 3.5.

@ExpandingMan
Copy link
Author

ExpandingMan commented Oct 10, 2016

Fixed by re-installing. Still no idea what was causing the problem.

I'm still getting segfaults if I do j.using("PackageX") where "PackageX" is (apparently) any package that has using PyCall.

@stevengj
Copy link
Member

Pkg.build("PyCall")?

@ExpandingMan
Copy link
Author

ExpandingMan commented Oct 11, 2016

Yes, PyCall has been built successfully.

I haven't been able to reproduce that error since I reinstalled (but PyCall was definitely built when it was thrown), so I really have no idea what happened.

Ok, I am still rather confused but at least now I can consistently reproduce the errors I am getting. I'm pretty sure these errors are only occurring for packages which use PyCall but I'm not certain (it's certainly not every package).

I get the following error

could not spawn `/usr/local/lib/python3.5/dist-packages/julia-0.1.1-py3.5.egg/julia/../fake-julia/julia -Cx86-64 -J/usr/lib/x86_64-linux-gnu/julia/sys.so --compile=yes --depwarn=yes -O0 --output-ji /home/savastio/.julia/lib/pyjulia3-v0.5/DatasToolbox.ji --output-incremental=yes --startup-file=no --history-file=no --color=no --eval 'while !eof(STDIN)
    eval(Main, deserialize(STDIN))
end
'`: no such file or directory (ENOENT)Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/julia-0.1.1-py3.5.egg/julia/core.py", line 447, in using
    self.eval("using %s" % module)
  File "/usr/local/lib/python3.5/dist-packages/julia-0.1.1-py3.5.egg/julia/core.py", line 429, in eval
    ans = self._call(src)
  File "/usr/local/lib/python3.5/dist-packages/julia-0.1.1-py3.5.egg/julia/core.py", line 392, in _call
    self.check_exception(src)
  File "/usr/local/lib/python3.5/dist-packages/julia-0.1.1-py3.5.egg/julia/core.py", line 412, in check_exception
    .format(exception_type, src))
julia.core.JuliaError: Exception 'UVError' occurred while calling julia code:
using DatasToolbox

However, if I am in the home directory of pyjulia I instead get

signal (11): Segmentation fault
while loading /home/savastio/.julia/v0.5/DatasToolbox/src/DatasToolbox.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/savastio/.julia/v0.5/PyCall/src/exception.jl:78 [inlined]
pyimport at /home/savastio/.julia/v0.5/PyCall/src/PyCall.jl:387
__init__ at /home/savastio/.julia/v0.5/PyCall/src/pyinit.jl:58
unknown function (ip: 0x7fa7a18925be)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
jl_apply at /build/julia-0ecDfF/julia-0.5.0/src/julia.h:1392 [inlined]
jl_module_run_initializer at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:83
jl_init_restored_modules at /build/julia-0ecDfF/julia-0.5.0/src/dump.c:1994 [inlined]
_jl_restore_incremental at /build/julia-0ecDfF/julia-0.5.0/src/dump.c:2560
_jl_restore_incremental at /build/julia-0ecDfF/julia-0.5.0/src/dump.c:2498 [inlined]
jl_restore_incremental at /build/julia-0ecDfF/julia-0.5.0/src/dump.c:2580
_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: 0x7fa9bb281ad0)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
require at ./loading.jl:371
unknown function (ip: 0x7fa9bb179eeb)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
jl_apply at /build/julia-0ecDfF/julia-0.5.0/src/julia.h:1392 [inlined]
eval_import_path_ at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:402
eval_import_path at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:429 [inlined]
jl_toplevel_eval_flex at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:480
jl_eval_module_expr at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:196
jl_toplevel_eval_flex at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:465
jl_parse_eval_all at /build/julia-0ecDfF/julia-0.5.0/src/ast.c:717
jl_load at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:596
jl_load_ at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:605
include_from_node1 at ./loading.jl:488
unknown function (ip: 0x7fa9bb13f16b)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
do_call at /build/julia-0ecDfF/julia-0.5.0/src/interpreter.c:66
eval at /build/julia-0ecDfF/julia-0.5.0/src/interpreter.c:190
jl_toplevel_eval_flex at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:558 [inlined]
jl_toplevel_eval at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:580
jl_toplevel_eval_in_warn at /build/julia-0ecDfF/julia-0.5.0/src/builtins.c:590
macro expansion; at ./none:2 [inlined]
anonymous at ./<missing> (unknown line)
unknown function (ip: 0x7fa7a187b681)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_toplevel_eval_flex at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:569 [inlined]
jl_toplevel_eval at /build/julia-0ecDfF/julia-0.5.0/src/toplevel.c:580
jl_toplevel_eval_in_warn at /build/julia-0ecDfF/julia-0.5.0/src/builtins.c:590
eval at ./boot.jl:234
unknown function (ip: 0x7fa9bb12a81f)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
process_options at ./client.jl:239
_start at ./client.jl:318
unknown function (ip: 0x7fa9bb164708)
jl_call_method_internal at /build/julia-0ecDfF/julia-0.5.0/src/julia_internal.h:189 [inlined]
jl_apply_generic at /build/julia-0ecDfF/julia-0.5.0/src/gf.c:1942
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: 0x7fa9bfca2fca)
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: 3101149 (Pool: 3100144; Big: 1005); GC: 3
ErrorException("Failed to precompile DatasToolbox to /home/savastio/.julia/lib/pyjulia3-v0.5/DatasToolbox.ji.")Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/savastio/pyjulia/julia/julia/core.py", line 447, in using
    self.eval("using %s" % module)
  File "/home/savastio/pyjulia/julia/julia/core.py", line 429, in eval
    ans = self._call(src)
  File "/home/savastio/pyjulia/julia/julia/core.py", line 392, in _call
    self.check_exception(src)
  File "/home/savastio/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 DatasToolbox

@stevengj
Copy link
Member

@Keno, this seems like a conflict between your "fake-julia" precompilation trick and precompilation of packages with PyCall. Does precompilation using fake-julia load the correct (pyjulia) version of PyCall? It doesn't seem like julia.py has the stuff from core.py to grab the correct PyCall version (the one built for the in-process libpython).

@goretkin
Copy link

I'm experiencing what I think is the same issue, using Julia v0.0.5 ( binary release), Python 2.7.6, Ubuntu 14.04

�[0;34mIn [�[1;34m1�[0;34m]: �[0mimport julia

�[0;34mIn [�[1;34m2�[0;34m]: �[0mjulia.Julia()
WARNING: redefining constant JULIA_HOME
InitError(:PyCall,PyError (:PyImport_ImportModule) <type 'exceptions.SystemError'>
SystemError('dynamic module not initialized properly',)

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
PyObject_Call at /usr/lib/x86_64-linux-gnu/libpython2.7.so (unknown line)
macro expansion at /home/goretkin/.julia/v0.5/PyCall/src/exception.jl:78 [inlined]
#_pycall#62 at /home/goretkin/.julia/v0.5/PyCall/src/PyCall.jl:546
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:189 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1942
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1392 [inlined]
jl_f__apply at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:547
_pycall at /home/goretkin/.julia/v0.5/PyCall/src/PyCall.jl:534
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:189 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1942
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1392 [inlined]
jl_f__apply at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:547
#pycall#65 at /home/goretkin/.julia/v0.5/PyCall/src/PyCall.jl:565
show at /home/goretkin/.julia/v0.5/PyCall/src/exception.jl:39
unknown function (ip: 0x7fadbb1476f6)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:189 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1942
show_default at ./show.jl:130
unknown function (ip: 0x7fadbb1460a6)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:189 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1942
show at ./show.jl:116
unknown function (ip: 0x7fadbb145b06)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:189 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1942
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1392 [inlined]
jl_show at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:972
ffi_call_unix64 at /usr/lib/x86_64-linux-gnu/libffi.so.6 (unknown line)
ffi_call at /usr/lib/x86_64-linux-gnu/libffi.so.6 (unknown line)
_ctypes_callproc at /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so (unknown line)
unknown function (ip: 0x7fafdd49ef9d)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
unknown function (ip: 0x56d0a9)
unknown function (ip: 0x4d9853)
unknown function (ip: 0x4d8378)
unknown function (ip: 0x4f5d0a)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalCode at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
unknown function (ip: 0x56d0a9)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalFrameEx at /usr/bin/python (unknown line)
PyEval_EvalCodeEx at /usr/bin/python (unknown line)
PyEval_EvalCode at /usr/bin/python (unknown line)
unknown function (ip: 0x469662)
PyRun_FileExFlags at /usr/bin/python (unknown line)
PyRun_SimpleFileExFlags at /usr/bin/python (unknown line)
Py_Main at /usr/bin/python (unknown line)
__libc_start_main at /build/buildd/eglibc-2.19/csu/libc-start.c:287
unknown function (ip: 0x57497d)
Allocations: 2235728 (Pool: 2234774; Big: 954); GC: 1
Segmentation fault (core dumped)

@Certhas
Copy link

Certhas commented Oct 24, 2016

Also seeing such an error, on multiple machines, Linux and OSX:
julia-error.txt

The minimal python test case looks like this. The hack makes no difference, in my private copy of the bugfixed package I get the same segmentation fault:

import julia

def f(t, x, dx):
    return x - dx

j = julia.Julia()
j.using("DASSL")

# Hack that is needed to massage the types when using the unmodified DASSL.jl
fwrap = j.eval('f -> (args...) -> f(args...)')
r = j.dasslSolve(fwrap, 1., [0., 10.])

@Alexander-Barth
Copy link

I had the same issue on Julia v0.5.0, (binary release), Python 2.7.6, Ubuntu 14.04, but a Pkg.rebuild("PyCall") after installing pyjulia solved this issue.

@ExpandingMan
Copy link
Author

Sorry all. I had completely forgotten about this and have recently reposted it as #92. I'll close this in favor of that one.

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

5 participants