Core dumped segmentation fault

username: gebrahimi
cooked: <p>I am running my code for graph convolutional networks and I use <code>NeighborSampler</code> from pytorch geometric package.</p>
<p>When I do <code>backtrace</code> using <code>gdb</code> package, I get the following. Can someone please point me to where the issue arises? Thank you.</p>
<pre><code class="lang-auto">0x00007ffec03498dd in sample_adj_cpu(at::Tensor, at::Tensor, at::Tensor, long, bool) () from /opt/conda/lib/python3.8/site-packages/torch_sparse/_sample_cuda.so
</code></pre>
<p>(gdb) where</p>
<pre><code class="lang-auto">#0  0x00007ffec03498dd in sample_adj_cpu(at::Tensor, at::Tensor, at::Tensor, long, bool) () from /opt/conda/lib/python3.8/site-packages/torch_sparse/_sample_cuda.so
#1  0x00007ffec03425e9 in sample_adj(at::Tensor, at::Tensor, at::Tensor, long, bool) () from /opt/conda/lib/python3.8/site-packages/torch_sparse/_sample_cuda.so
#2  0x00007ffec0347df7 in std::decay&lt;c10::guts::infer_function_traits&lt;c10::impl::detail::WrapFunctionIntoRuntimeFunctor_&lt;std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt; (*)(at::Tensor, at::Tensor, at::Tensor, long, bool), std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt;, c10::guts::typelist::typelist&lt;at::Tensor, at::Tensor, at::Tensor, long, bool&gt; &gt; &gt;::type::return_type&gt;::type c10::impl::call_functor_with_args_from_stack_&lt;c10::impl::detail::WrapFunctionIntoRuntimeFunctor_&lt;std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt; (*)(at::Tensor, at::Tensor, at::Tensor, long, bool), std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt;, c10::guts::typelist::typelist&lt;at::Tensor, at::Tensor, at::Tensor, long, bool&gt; &gt;, true, 0ul, 1ul, 2ul, 3ul, 4ul&gt;(c10::impl::detail::WrapFunctionIntoRuntimeFunctor_&lt;std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt; (*)(at::Tensor, at::Tensor, at::Tensor, long, bool), std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt;, c10::guts::typelist::typelist&lt;at::Tensor, at::Tensor, at::Tensor, long, bool&gt; &gt;*, std::vector&lt;c10::IValue, std::allocator&lt;c10::IValue&gt; &gt;*, std::integer_sequence&lt;unsigned long, 0ul, 1ul, 2ul, 3ul, 4ul&gt;) ()
   from /opt/conda/lib/python3.8/site-packages/torch_sparse/_sample_cuda.so
#3  0x00007ffec03481bd in c10::impl::make_boxed_from_unboxed_functor&lt;c10::impl::detail::WrapFunctionIntoRuntimeFunctor_&lt;std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt; (*)(at::Tensor, at::Tensor, at::Tensor, long, bool), std::tuple&lt;at::Tensor, at::Tensor, at::Tensor, at::Tensor&gt;, c10::guts::typelist::typelist&lt;at::Tensor, at::Tensor, at::Tensor, long, bool&gt; &gt;, true&gt;::call(c10::OperatorKernel*, c10::OperatorHandle const&amp;, std::vector&lt;c10::IValue, std::allocator&lt;c10::IValue&gt; &gt;*) () from /opt/conda/lib/python3.8/site-packages/torch_sparse/_sample_cuda.so
#4  0x00007fff66c5b4b5 in torch::jit::(anonymous namespace)::createOperatorFromC10_withTracingHandledHere(c10::OperatorHandle const&amp;)::{lambda(std::vector&lt;c10::IValue, std::allocator&lt;c10::IValue&gt; &gt;*)#1}::operator()(std::vector&lt;c10::IValue, std::allocator&lt;c10::IValue&gt; &gt;*) const () from /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so
#5  0x00007fffba35ae82 in torch::jit::invokeOperatorFromPython(std::vector&lt;std::shared_ptr&lt;torch::jit::Operator&gt;, std::allocator&lt;std::shared_ptr&lt;torch::jit::Operator&gt; &gt; &gt; const&amp;, pybind11::args, pybind11::kwargs const&amp;) () from /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch_python.so
#6  0x00007fffba333dd2 in torch::jit::initJITBindings(_object*)::{lambda(std::string const&amp;)#115}::operator()(std::string const&amp;) const::{lambda(pybind11::args, {lambda(std::string const&amp;)#115}::kwargs)#1}::operator()(pybind11, pybind11::args) const () from /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch_python.so
#7  0x00007fffba3344cf in void pybind11::cpp_function::initialize&lt;torch::jit::initJITBindings(_object*)::{lambda(std::string const&amp;)#115}::operator()(std::string const&amp;) const::{lambda(pybind11::args, pybind11::kwargs)#1}, pybind11::object, {lambda(std::string const&amp;)#115}, pybind11::args, pybind11::name, pybind11::doc&gt;(torch::jit::initJITBindings(_object*)::{lambda(std::string const&amp;)#115}::operator()(std::string const&amp;) const::{lambda(pybind11::args, pybind11::kwargs)#1}&amp;&amp;, pybind11::object (*)({lambda(std::string const&amp;)#115}, pybind11::args), pybind11::name const&amp;, pybind11::doc const&amp;)::{lambda(pybind11::detail::function_call&amp;)#3}::_FUN(pybind11::detail) () from /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch_python.so
#8  0x00007fffb9f7035e in pybind11::cpp_function::dispatcher(_object*, _object*, _object*) () from /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch_python.so
#9  0x00005555556a82d8 in cfunction_call_varargs (kwargs=&lt;optimized out&gt;, args=&lt;optimized out&gt;, func=0x7ffd8802dc70) at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:743
#10 PyCFunction_Call () at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:773
#11 0x0000555555697edc in _PyObject_MakeTpCall.localalias.6 () at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:159
#12 0x0000555555723879 in _PyObject_Vectorcall (kwnames=0x0, nargsf=&lt;optimized out&gt;, args=0x5557142b3fa8, callable=0x7ffd8802dc70)
    at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:125
#13 call_function (kwnames=0x0, oparg=&lt;optimized out&gt;, pp_stack=&lt;synthetic pointer&gt;, tstate=0x5555558f3720) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4963
#14 _PyEval_EvalFrameDefault () at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:3469
#15 0x00005555556ed760 in PyEval_EvalFrameEx (throwflag=0, f=0x5557142b3de0) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:741
#16 _PyEval_EvalCodeWithName.localalias.4 () at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4298
#17 0x00005555556ee970 in _PyFunction_Vectorcall (kwnames=&lt;optimized out&gt;, nargsf=&lt;optimized out&gt;, stack=0x5557142f2160, func=0x7ffead8328b0)
    at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:436
#18 _PyObject_Vectorcall (kwnames=&lt;optimized out&gt;, nargsf=&lt;optimized out&gt;, args=0x5557142f2160, callable=0x7ffead8328b0) at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#19 method_vectorcall () at /tmp/build/80754af9/python_1614202678154/work/Objects/classobject.c:60
#20 0x0000555555657562 in _PyObject_Vectorcall (kwnames=0x7ffff6da7ca0, nargsf=&lt;optimized out&gt;, args=&lt;optimized out&gt;, callable=0x7ffd33a4fe40)
    at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#21 call_function (kwnames=0x7ffff6da7ca0, oparg=&lt;optimized out&gt;, pp_stack=&lt;synthetic pointer&gt;, tstate=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4963
#22 _PyEval_EvalFrameDefault (f=&lt;optimized out&gt;, throwflag=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:3515
#23 0x00005555556ee85b in function_code_fastcall (globals=&lt;optimized out&gt;, nargs=2, args=&lt;optimized out&gt;, co=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:284
#24 _PyFunction_Vectorcall (kwnames=&lt;optimized out&gt;, nargsf=&lt;optimized out&gt;, stack=0x7ffcaf8b8a90, func=0x7ffead829b80) at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:411
#25 _PyObject_Vectorcall (kwnames=&lt;optimized out&gt;, nargsf=&lt;optimized out&gt;, args=0x7ffcaf8b8a90, callable=0x7ffead829b80) at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#26 method_vectorcall () at /tmp/build/80754af9/python_1614202678154/work/Objects/classobject.c:60
#27 0x00005555556579bd in _PyObject_Vectorcall (kwnames=0x0, nargsf=&lt;optimized out&gt;, args=0x7ffcaf8b8a98, callable=0x7ffd3375b200)
    at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#28 call_function (kwnames=0x0, oparg=&lt;optimized out&gt;, pp_stack=&lt;synthetic pointer&gt;, tstate=0x5555558f3720) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4963
#29 _PyEval_EvalFrameDefault (f=&lt;optimized out&gt;, throwflag=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:3469
#30 0x00005555556edd11 in PyEval_EvalFrameEx (throwflag=0, f=0x7ffcaf8b8900) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:741
#31 _PyEval_EvalCodeWithName.localalias.4 () at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4298
#32 0x00005555556ee593 in _PyFunction_Vectorcall.localalias.352 () at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:436
#33 0x000055555565799c in _PyObject_Vectorcall (kwnames=0x0, nargsf=&lt;optimized out&gt;, args=0x7ffcaf8b9768, callable=0x7ffec9548040)
    at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#34 call_function (kwnames=0x0, oparg=&lt;optimized out&gt;, pp_stack=&lt;synthetic pointer&gt;, tstate=0x5555558f3720) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4963
#35 _PyEval_EvalFrameDefault (f=&lt;optimized out&gt;, throwflag=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:3486
#36 0x00005555556ee4bb in function_code_fastcall (globals=&lt;optimized out&gt;, nargs=1, args=&lt;optimized out&gt;, co=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:284
#37 _PyFunction_Vectorcall.localalias.352 () at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:411
---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---
#38 0x000055555565799c in _PyObject_Vectorcall (kwnames=0x0, nargsf=&lt;optimized out&gt;, args=0x7ffd336e2990, callable=0x7ffec9548b80)
    at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#39 call_function (kwnames=0x0, oparg=&lt;optimized out&gt;, pp_stack=&lt;synthetic pointer&gt;, tstate=0x5555558f3720) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4963
#40 _PyEval_EvalFrameDefault (f=&lt;optimized out&gt;, throwflag=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:3486
#41 0x00005555556ee4bb in function_code_fastcall (globals=&lt;optimized out&gt;, nargs=1, args=&lt;optimized out&gt;, co=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:284
#42 _PyFunction_Vectorcall.localalias.352 () at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:411
#43 0x000055555569cc4b in _PyObject_Vectorcall (kwnames=0x0, nargsf=1, args=0x7fffffffc810, callable=0x7ffec9548940) at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#44 _PyObject_FastCall () at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:147
#45 _PyObject_FastCall_Prepend () at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:850
#46 0x00005555556ac30e in call_unbound (nargs=0, args=0x0, self=0x7ffd328d48b0, func=0x7ffec9548940, unbound=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Objects/typeobject.c:1453
#47 call_method (nargs=0, args=0x0, name=0x5555558b1c20 &lt;PyId___next__.15157&gt;, obj=0x7ffd328d48b0) at /tmp/build/80754af9/python_1614202678154/work/Objects/typeobject.c:1485
#48 slot_tp_iternext () at /tmp/build/80754af9/python_1614202678154/work/Objects/typeobject.c:6732
#49 0x000055555571fd89 in _PyEval_EvalFrameDefault () at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:3202
#50 0x00005555556edd11 in PyEval_EvalFrameEx (throwflag=0, f=0x5556ca043150) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:741
#51 _PyEval_EvalCodeWithName.localalias.4 () at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4298
#52 0x00005555556ee593 in _PyFunction_Vectorcall.localalias.352 () at /tmp/build/80754af9/python_1614202678154/work/Objects/call.c:436
#53 0x000055555565799c in _PyObject_Vectorcall (kwnames=0x0, nargsf=&lt;optimized out&gt;, args=0x7ffff7ec35b0, callable=0x7ffe2889b430)
    at /tmp/build/80754af9/python_1614202678154/work/Include/cpython/abstract.h:127
#54 call_function (kwnames=0x0, oparg=&lt;optimized out&gt;, pp_stack=&lt;synthetic pointer&gt;, tstate=0x5555558f3720) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4963
#55 _PyEval_EvalFrameDefault (f=&lt;optimized out&gt;, throwflag=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:3486
#56 0x00005555556ed760 in PyEval_EvalFrameEx (throwflag=0, f=0x7ffff7ec3440) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:741
#57 _PyEval_EvalCodeWithName.localalias.4 () at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4298
#58 0x00005555557824e3 in PyEval_EvalCodeEx () at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:4327
#59 PyEval_EvalCode (co=&lt;optimized out&gt;, globals=&lt;optimized out&gt;, locals=&lt;optimized out&gt;) at /tmp/build/80754af9/python_1614202678154/work/Python/ceval.c:718
#60 0x0000555555782584 in run_eval_code_obj () at /tmp/build/80754af9/python_1614202678154/work/Python/pythonrun.c:1165
#61 0x00005555557a87c4 in run_mod () at /tmp/build/80754af9/python_1614202678154/work/Python/pythonrun.c:1187
#62 0x0000555555669620 in pyrun_file (fp=0x55555595b560, filename=0x7ffff7ee7e40, start=&lt;optimized out&gt;, globals=0x7ffff7f26380, locals=0x7ffff7f26380, closeit=1, flags=0x7fffffffce88)
    at /tmp/build/80754af9/python_1614202678154/work/Python/pythonrun.c:1084
#63 0x000055555566c362 in pyrun_simple_file (flags=0x7fffffffce88, closeit=1, filename=0x7ffff7ee7e40, fp=0x55555595b560) at /tmp/build/80754af9/python_1614202678154/work/Python/pythonrun.c:439
#64 PyRun_SimpleFileExFlags (fp=0x55555595b560, filename=&lt;optimized out&gt;, closeit=1, flags=0x7fffffffce88) at /tmp/build/80754af9/python_1614202678154/work/Python/pythonrun.c:472
#65 0x000055555566ce80 in pymain_run_file (cf=0x7fffffffce88, config=0x5555558f2b30) at /tmp/build/80754af9/python_1614202678154/work/Modules/main.c:391
#66 pymain_run_python (exitcode=0x7fffffffce80) at /tmp/build/80754af9/python_1614202678154/work/Modules/main.c:616
#67 Py_RunMain () at /tmp/build/80754af9/python_1614202678154/work/Modules/main.c:695
#68 0x00005555557ab979 in Py_BytesMain () at /tmp/build/80754af9/python_1614202678154/work/Modules/main.c:1141
#69 0x00007ffff77e4bf7 in __libc_start_main (main=0x55555566d6f0 &lt;main&gt;, argc=2, argv=0x7fffffffd078, init=&lt;optimized out&gt;, fini=&lt;optimized out&gt;, rtld_fini=&lt;optimized out&gt;, stack_end=0x7fffffffd068)
    at ../csu/libc-start.c:310
#70 0x000055555573b185 in _start () at ../sysdeps/x86_64/elf/start.S:103

</code></pre>

username: ptrblck
cooked: <p>The segfault seems to be raised by <code>torch_sparse</code> in <code>sample_adj_cpu</code> so I would recommend to create an issue in their GitHub repository so that the devs could try to debug and fix it.</p>