{"action":"created","issue":{"url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/189","labels_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/189/comments","events_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/189/events","html_url":"https://github.com/stevengj/PyCall.jl/issues/189","id":105898365,"number":189,"title":"Segfault running tests on Linux","user":{"login":"simonster","id":470884,"avatar_url":"https://avatars.githubusercontent.com/u/470884?v=3","gravatar_id":"","url":"https://api.github.com/users/simonster","html_url":"https://github.com/simonster","followers_url":"https://api.github.com/users/simonster/followers","following_url":"https://api.github.com/users/simonster/following{/other_user}","gists_url":"https://api.github.com/users/simonster/gists{/gist_id}","starred_url":"https://api.github.com/users/simonster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonster/subscriptions","organizations_url":"https://api.github.com/users/simonster/orgs","repos_url":"https://api.github.com/users/simonster/repos","events_url":"https://api.github.com/users/simonster/events{/privacy}","received_events_url":"https://api.github.com/users/simonster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-10T21:10:17Z","updated_at":"2015-09-10T21:16:17Z","closed_at":null,"body":"On Linux, when I try to run the tests on master, I get a segfault:\r\n\r\n```julia\r\nsignal (11): Segmentation fault\r\nPyObject_IsInstance at /usr/lib/x86_64-linux-gnu/libpython2.7.so (unknown line)\r\npyisinstance at /home/simon/.julia/PyCall/src/PyCall.jl:100\r\njlcall_pyisinstance_21189 at  (unknown line)\r\njl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)\r\npyptr_query at /home/simon/.julia/PyCall/src/conversions.jl:147\r\npytype_query at /home/simon/.julia/PyCall/src/conversions.jl:783\r\nconvert at /home/simon/.julia/PyCall/src/conversions.jl:832\r\nroundtripeq at /home/simon/.julia/PyCall/test/runtests.jl:6\r\njlcall_roundtripeq_21432 at  (unknown line)\r\njl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)\r\nanonymous at test.jl:92\r\ndo_test at test.jl:50\r\njl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)\r\nunknown function (ip: 0x7f5083fe4ed3)\r\nunknown function (ip: 0x7f5083fe426e)\r\nunknown function (ip: 0x7f5083ff9a0b)\r\nunknown function (ip: 0x7f5083ffa72c)\r\njl_load at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)\r\ninclude at ./boot.jl:260\r\njl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)\r\ninclude_from_node1 at ./loading.jl:271\r\njl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)\r\nprocess_options at ./client.jl:316\r\n_start at ./client.jl:411\r\nunknown function (ip: 0x7f50810f0d89)\r\njl_apply_generic at /usr/local/julia/usr/bin/../lib/libjulia.so (unknown line)\r\nunknown function (ip: 0x401ae7)\r\nunknown function (ip: 0x4016af)\r\n__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)\r\nunknown function (ip: 0x4016f9)\r\nunknown function (ip: (nil))\r\nfish: Job 1, “julia test/runtests.jl” terminated by signal SIGSEGV (Address boundary error)\r\n```\r\n\r\nAdding 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.\r\n\r\nI can't reproduce this on OS X, but `dlopen` is global there by default.\r\n\r\nMy `versioninfo()` is:\r\n\r\n```\r\njulia> versioninfo()\r\nJulia Version 0.5.0-dev+3\r\nCommit 7cd05db* (2015-09-09 19:05 UTC)\r\nPlatform Info:\r\n  System: Linux (x86_64-linux-gnu)\r\n  CPU: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz\r\n  WORD_SIZE: 64\r\n  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)\r\n  LAPACK: libopenblas\r\n  LIBM: libopenlibm\r\n  LLVM: libLLVM-3.3\r\n```"},"comment":{"url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/comments/139381661","html_url":"https://github.com/stevengj/PyCall.jl/issues/189#issuecomment-139381661","issue_url":"https://api.github.com/repos/stevengj/PyCall.jl/issues/189","id":139381661,"user":{"login":"simonster","id":470884,"avatar_url":"https://avatars.githubusercontent.com/u/470884?v=3","gravatar_id":"","url":"https://api.github.com/users/simonster","html_url":"https://github.com/simonster","followers_url":"https://api.github.com/users/simonster/followers","following_url":"https://api.github.com/users/simonster/following{/other_user}","gists_url":"https://api.github.com/users/simonster/gists{/gist_id}","starred_url":"https://api.github.com/users/simonster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonster/subscriptions","organizations_url":"https://api.github.com/users/simonster/orgs","repos_url":"https://api.github.com/users/simonster/repos","events_url":"https://api.github.com/users/simonster/events{/privacy}","received_events_url":"https://api.github.com/users/simonster/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T21:16:17Z","updated_at":"2015-09-10T21:16:17Z","body":"In case it's useful, without RTLD_GLOBAL, importing ctypes [here](https://github.com/stevengj/PyCall.jl/blob/252b2d4d91526ae8a224ea97cbf51c14a14447ca/src/pyinit.jl#L72) throws:\r\n\r\n```\r\nImportError('/usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so: undefined symbol: PyFloat_Type',)\r\n```\r\n\r\nso the [catch clause](https://github.com/stevengj/PyCall.jl/blob/252b2d4d91526ae8a224ea97cbf51c14a14447ca/src/pyinit.jl#L75-L76) 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."}}