Skip to content

Segfault running tests on Linux #189

Closed

Description

@simonster

On Linux, when I try to run the tests on PyCall master, I get a segfault:

signal (11): Segmentation fault
PyObject_IsInstance at /usr/lib/x86_64-linux-gnu/libpython2.7.so (unknown line)
pyisinstance at /home/simon/.julia/PyCall/src/PyCall.jl:100
jlcall_pyisinstance_21189 at  (unknown line)
jl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)
pyptr_query at /home/simon/.julia/PyCall/src/conversions.jl:147
pytype_query at /home/simon/.julia/PyCall/src/conversions.jl:783
convert at /home/simon/.julia/PyCall/src/conversions.jl:832
roundtripeq at /home/simon/.julia/PyCall/test/runtests.jl:6
jlcall_roundtripeq_21432 at  (unknown line)
jl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)
anonymous at test.jl:92
do_test at test.jl:50
jl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 0x7f5083fe4ed3)
unknown function (ip: 0x7f5083fe426e)
unknown function (ip: 0x7f5083ff9a0b)
unknown function (ip: 0x7f5083ffa72c)
jl_load at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:260
jl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:271
jl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:316
_start at ./client.jl:411
unknown function (ip: 0x7f50810f0d89)
jl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 0x401ae7)
unknown function (ip: 0x4016af)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4016f9)
unknown function (ip: (nil))
fish: Job 1, “julia test/runtests.jl” terminated by signal SIGSEGV (Address boundary error)

Adding the line Libdl.dlopen(libpython, Libdl.RTLD_LAZY|Libdl.RTLD_DEEPBIND|Libdl.RTLD_GLOBAL) to the start of __init__ appears to fix this. I'm not really sure what's going on, but it appears the segfault is somehow related to the libpython symbols not being available to other libraries.

I can't reproduce this on OS X, but dlopen is global there by default.

My versioninfo() is:

julia> versioninfo()
Julia Version 0.5.0-dev+3
Commit 7cd05db* (2015-09-09 19:05 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Activity

  1. simonster commented on Sep 10, 2015

    @simonster
    MemberAuthor

    In case it's useful, without RTLD_GLOBAL, importing ctypes here throws:

    ImportError('/usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so: undefined symbol: PyFloat_Type',)
    

    so the catch clause gets taken. With the dlopen line above importing ctypes works, but if I force the code in the catch clause to be run, the tests still segfault.

  2. tbreloff commented on Sep 13, 2015

    @tbreloff

    I'm wondering if this crash is related in any way. This was on OS X.

  3. stevengj commented on Sep 15, 2015

    @stevengj
    Member

    Have you tried the PyCall master?

  4. stevengj commented on Sep 15, 2015

    @stevengj
    Member

    I can reproduce. Will incorporate the dlopen workaround shortly.

  5. jmxpearson commented on Sep 16, 2015

    @jmxpearson
    Contributor

    Thank you for this. I have been running into this issue as of this afternoon.

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