8000 segmentation fault while import torch · Issue #96797 · pytorch/pytorch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

segmentation fault while import torch #96797

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

Closed
leastsq opened this issue Mar 15, 2023 · 3 comments
Closed

segmentation fault while import torch #96797

leastsq opened this issue Mar 15, 2023 · 3 comments
Labels
module: crash Problem manifests as a hard crash, as opposed to a RuntimeError needs reproduction Someone else needs to try reproducing the issue given the instructions. No action needed from user triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@leastsq
Copy link
leastsq commented Mar 15, 2023

🐛 Describe the bug

core dumpped when import torch, I test serveral version of torch, but same problem happens.
Running https://github.com/pytorch/pytorch/blob/master/torch/utils/collect_env.py also crashed because the error can not be catched

GDB:
00005555556ee8d4 in type_name (type=0x555556fda9b8, context=0x0) at Objects/typeobject.c:411
411 Py_INCREF(et->ht_name);
(gdb) bt
#0 0x00005555556ee8d4 in type_name (type=0x555556fda9b8, context=0x0) at Objects/typeobject.c:411
#1 0x000055555569be29 in type_getattro (type=0x555556fda9b8, name=0x7ffff6845e30) at Objects/typeobject.c:3178
#2 0x00005555556ebadb in PyObject_GetAttrString (v=0x555556fda9b8, name=) at Objects/object.c:780
#3 0x00007ffff534d45d in pybind11::detail::accessorpybind11::detail::accessor_policies::str_attr::get_cache() const () from /home/fr1511b/lib/libtorch_python.so
#4 0x00007ffff546c3ff in pybind11::detail::enum_base::init(bool, bool)::{lambda(pybind11::object)#1}::operator()(pybind11::object) const ()
from /home/fr1511b/lib/libtorch_python.so
#5 0x00007ffff546c7d0 in pybind11::cpp_function::initialize<pybind11::detail::enum_base::init(bool, bool)::{lambda(pybind11::object)#1}, pybind11::str, pybind11::object, pybind11::name, pybind11::is_method>(pybind11::detail::enum_base::init(bool, bool)::{lambda(pybind11::object)#1}&&, pybind11::str ()(pybind11::object), pybind11::name const&, pybind11::is_method const&)::{lambda(pybind11::detail::function_call&)#3}::_FUN(pybind11::detail::function_call&) () from /home/fr1511b/lib/libtorch_python.so
#6 0x00007ffff5116795 in pybind11::cpp_function::dispatcher(_object
, _object*, _object*) () from /home/fr1511b/lib/libtorch_python.so
#7 0x0000555555681deb in _PyMethodDef_RawFastCallDict (method=0x555556fdaf10, self=0x7ffff69f7870, args=, nargs=, kwargs=0x0)
at Objects/call.c:515
#8 0x0000555555683578 in _PyCFunction_FastCallDict (kwargs=0x0, nargs=1, args=0x7fffffffa0f0, func=0x7ffff68b2798) at Objects/call.c:582
#9 _PyObject_FastCallDict (kwargs=0x0, nargs=1, args=0x7fffffffa0f0, callable=0x7ffff68b2798) at Objects/call.c:101
#10 _PyObject_Call_Prepend (callable=0x7ffff68b2798, obj=, args=0x7ffff7e6d048, kwargs=0x0) at Objects/call.c:904
#11 0x00005555556819d9 in _PyObject_FastCallDict (callable=0x7ffff7b903c8, args=, nargs=, kwargs=0x0) at Objects/call.c:125
#12 0x00005555555d9fc3 in slot_tp_repr (self=0x7ffff6844378) at Objects/typeobject.c:6305
#13 0x00005555556ebb51 in PyObject_Repr (v=0x7ffff6844378) at Objects/object.c:473
#14 0x00007ffff5110c7b in pybind11::cpp_function::initialize_generic(std::unique_ptr<pybind11::detail::function_record, pybind11::cpp_function::InitializingFunctionRecordDeleter>&&, char const*, std::type_info const* const*, unsigned long) () from /home/fr1511b/lib/libtorch_python.so
#15 0x00007ffff55a326f in torch::jit::initPythonIRBindings(_object*) () from /home/fr1511b/lib/libtorch_python.so
#16 0x00007ffff54d75f3 in torch::jit::initJITBindings(_object*) () from /home/fr1511b/lib/libtorch_python.so
#17 0x00007ffff537c52a in initModule () from /home/fr1511b/lib/libtorch_python.so
#18 0x00005555556fb261 in _PyImport_LoadDynamicModuleWithSpec (spec=spec@entry=0x7ffff6a04128, fp=fp@entry=0x0) at ./Python/importdl.c:159
#19 0x00005555556fab61 in _imp_create_dynamic_impl (module=, file=, spec=0x7ffff6a04128) at Python/import.c:2159
#20 _imp_create_dynamic (module=, args=, nargs=) at Python/clinic/import.c.h:289
#21 0x0000555555681dd9 in _PyMethodDef_RawFastCallDict (method=0x5555557e8c20 <imp_methods+320>, self=0x7ffff7e5d778, args=0x7ffff6a040d0, nargs=1, kwargs=0x7ffff7a7f360)
at Objects/call.c:530
#22 0x0000555555681b4e in _PyCFunction_FastCallDict (func=0x7ffff7e63dc8, args=, nargs=, kwargs=) at Objects/call.c:582
#23 0x00005555556af2a3 in do_call_core (kwdict=0x7ffff7a7f360, callargs=0x7ffff6a040b8, func=0x7ffff7e63dc8) at Python/ceval.c:4627
#24 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3191
#25 0x00005555556acef0 in PyEval_EvalFrameEx (throwflag=0, f=0x5555558ede68) at Python/ceval.c:547
#26 _PyEval_EvalCodeWithName (_co=, globals=, locals=locals@entry=0x0, args=args@entry=0x7ffff7ae9730, argcount=argcount@entry=2,
kwnames=0x0, kwargs=0x7ffff7ae9740, kwcount=0, kwstep=1, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x7ffff7e47b70, qualname=0x7ffff7e47b70)
at Python/ceval.c:3930
#27 0x0000555555682b68 in _PyFunction_FastCallKeywords (func=, stack=0x7ffff7ae9730, nargs=2, kwnames=) at Objects/call.c:433
#28 0x00005555556b2eeb in call_function (pp_stack=0x7fffffffbda0, oparg=, kwnames=0x0) at Python/ceval.c:4602
#29 0x00005555556b14c8 in _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3093
#30 0x0000555555682ada in function_code_fastcall (globals=, nargs=2, args=, co=) at Objects/call.c:283
#31 _PyFunction_FastCallKeywords (func=, stack=0x7ffff7e61528, nargs=2, kwnames=) at Objects/call.c:408
#32 0x00005555556b2eeb in call_function (pp_stack=0x7fffffffbf70, oparg=, kwnames=0x0) at Python/ceval.c:4602
#33 0x00005555556adfcd in _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3110
#34 0x0000555555682ada in function_code_fastcall (globals=, nargs=1, args=, co=) at Objects/call.c:283
#35 _PyFunction_FastCallKeywords (func=, stack=0x7ffff69f13a8, nargs=1, kwnames=) at Objects/call.c:408
#36 0x00005555556b2eeb in call_function (pp_stack=0x7fffffffc148, oparg=, kwnames=0x0) at Python/ceval.c:4602
#37 0x00005555556addb6 in _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3124

Versions

ENV:
Ubuntu 22.04
Python 3.7.1
CUDA Version: No cuda
CPU: AMD r2500u
PyTorch version: I tested all versions from 1.7.1 to 1.13.1 with CPU

@soulitzer soulitzer added needs reproduction Someone else needs to try reproducing the issue given the instructions. No action needed from user module: crash Problem manifests as a hard crash, as opposed to a RuntimeError triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Mar 16, 2023
@soulitzer
Copy link
Contributor
soulitzer commented Mar 16, 2023

Could you update in the collect_env.py script:

Change

try:
    import torch
    TORCH_AVAILABLE = True
except (ImportError, NameError, AttributeError, OSError):
    TORCH_AVAILABLE = False

to

TORCH_AVAILABLE = False

And see if that runs?

@leastsq
Copy link
Author
leastsq commented Mar 20, 2023 via email

@soulitzer
Copy link
Contributor

That's interesting, glad to hear that the issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: crash Problem manifests as a hard crash, as opposed to a RuntimeError needs reproduction Someone else needs to try reproducing the issue given the instructions. No action needed from user triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

2 participants
0