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

read_video_from_file() causes seg fault with Python 3.9 #4430

Open
Tracked by #4459
prabhat00155 opened this issue Sep 16, 2021 · 1 comment
Open
Tracked by #4459

read_video_from_file() causes seg fault with Python 3.9 #4430

prabhat00155 opened this issue Sep 16, 2021 · 1 comment

Comments

@prabhat00155
Copy link
Contributor

prabhat00155 commented Sep 16, 2021

🐛 Describe the bug

https://app.circleci.com/pipelines/github/pytorch/vision/10411/workflows/5783f083-26e2-4209-b9c6-976de289d637/jobs/791355

Program received signal SIGSEGV, Segmentation fault.
0x00007f87b3031d22 in ?? () from /root/project/env/lib/libswscale.so.5
Missing separate debuginfos, use: debuginfo-install glibc-2.17-324.el7_9.x86_64
(gdb) bt
#0  0x00007f87b3031d22 in ?? () from /root/project/env/lib/libswscale.so.5
#1  0x00007f87b3030be4 in ?? () from /root/project/env/lib/libswscale.so.5
#2  0x00007f87b3006af4 in sws_scale () from /root/project/env/lib/libswscale.so.5
#3  0x00007f87b4ab1932 in ffmpeg::(anonymous namespace)::transformImage(SwsContext*, unsigned char const* const*, int*, ffmpeg::VideoFormat, ffmpeg::VideoFormat, unsigned char*, unsigned char**, int*) [clone .isra.9] ()
   from /root/project/torchvision/video_reader.so
#4  0x00007f87b4ab1bd9 in ffmpeg::VideoSampler::sample(unsigned char const* const*, int*, ffmpeg::ByteStorage*) () from /root/project/torchvision/video_reader.so
#5  0x00007f87b4ab2ac7 in ffmpeg::VideoStream::copyFrameBytes(ffmpeg::ByteStorage*, bool) () from /root/project/torchvision/video_reader.so
#6  0x00007f87b4aaea9a in ffmpeg::Stream::decodePacket(AVPacket const*, ffmpeg::DecoderOutputMessage*, bool, bool*) () from /root/project/torchvision/video_reader.so
#7  0x00007f87b4aaa183 in ffmpeg::Decoder::processPacket(ffmpeg::Stream*, AVPacket*, bool*, bool*) () from /root/project/torchvision/video_reader.so
#8  0x00007f87b4aaa80a in ffmpeg::Decoder::getFrame(unsigned long) () from /root/project/torchvision/video_reader.so
#9  0x00007f87b4aafe81 in ffmpeg::SyncDecoder::decode(ffmpeg::DecoderOutputMessage*, unsigned long) () from /root/project/torchvision/video_reader.so
#10 0x00007f87b4adbb55 in vision::video_reader::(anonymous namespace)::readVideo(bool, at::Tensor const&, std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long) ()
   from /root/project/torchvision/video_reader.so
#11 0x00007f87b4add99a in vision::video_reader::read_video_from_file(std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long) () from /root/project/torchvision/video_reader.so
#12 0x00007f87b4ae0d8f in std::decay<c10::guts::infer_function_traits<c10::impl::detail::WrapFunctionIntoRuntimeFunctor_<c10::List<at::Tensor> (*)(std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long), c10::List<at::Tensor>, c10::guts::typelist::typelist<std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long> > >::type::return_type>::type c10::impl::call_functor_with_args_from_stack_<c10::impl::detail::WrapFunctionIntoRuntimeFunctor_<c10::List<at::Tensor> (*)(std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long), c10::List<at::Tensor>, c10::guts::typelist::typelist<std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long> >, false, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul, 11ul, 12ul, 13ul, 14ul, 15ul, 16ul, 17ul, 18ul, std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long>(c10::OperatorKernel*, c10::DispatchKeySet, std::vector<c10::IValue, std::allocator<c10::IValue> >*, std::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul, 10ul, 11ul, 12ul, 13ul, 14ul, 15ul, 16ul, 17ul, 18ul>, c10::guts::typelist::typelist<std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long>*) () from /root/project/torchvision/video_reader.so
#13 0x00007f87b4ae0e92 in c10::impl::make_boxed_from_unboxed_functor<c10::impl::detail::WrapFunctionIntoRuntimeFunctor_<c10::List<at::Tensor> (*)(std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long), c10::List<at::Tensor>, c10::guts::typelist::typelist<std::string, double, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long> >, false>::call(c10::OperatorKernel*, c10::OperatorHandle const&, c10::DispatchKeySet, std::vector<c10::IValue, std::allocator<c10::IValue> >*) () from /root/project/torchvision/video_reader.so
#14 0x00007f881b9ef98b in std::_Function_handler<void (std::vector<c10::IValue, std::allocator<c10::IValue> >&), torch::jit::(anonymous namespace)::createOperatorFromC10(c10::OperatorHandle const&)::{lambda(std::vector<c10::IValue, std::allocator<c10::IValue> >&)#1}>::_M_invoke(std::_Any_data const&, std::vector<c10::IValue, std::allocator<c10::IValue> >&) () from /root/project/env/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so
#15 0x00007f88239dbb53 in torch::jit::invokeOperatorFromPython(std::vector<std::shared_ptr<torch::jit::Operator>, std::allocator<std::shared_ptr<torch::jit::Operator> > > const&, pybind11::args, pybind11::kwargs const&) ()
   from /root/project/env/lib/python3.9/site-packages/torch/lib/libtorch_python.so
#16 0x00007f88239af864 in torch::jit::initJITBindings(_object*)::{lambda(std::string const&)#132}::operator()(std::string const&) const::{lambda(pybind11::args, {lambda(std::string const&)#132}::kwargs)#1}::operator()(pybind11, pybind11::args) const ()
   from /root/project/env/lib/python3.9/site-packages/torch/lib/libtorch_python.so
#17 0x00007f88239b002f in void pybind11::cpp_function::initialize<torch::jit::initJITBindings(_object*)::{lambda(std::string const&)#132}::operator()(std::string const&) const::{lambda(pybind11::args, pybind11::kwargs)#1}, pybind11::object, {lambda(std::string const&)#132}, pybind11::args, pybind11::name, pybind11::doc>(torch::jit::initJITBindings(_object*)::{lambda(std::string const&)#132}::operator()(std::string const&) const::{lambda(pybind11::args, pybind11::kwargs)#1}&&, pybind11::object (*)({lambda(std::string const&)#132}, pybind11::args), pybind11::name const&, pybind11::doc const&)::{lambda(pybind11::detail::function_call&)#3}::_FUN(pybind11::detail) () from /root/project/env/lib/python3.9/site-packages/torch/lib/libtorch_python.so
#18 0x00007f882312d63b in pybind11::cpp_function::dispatcher(_object*, _object*, _object*) () from /root/project/env/lib/python3.9/site-packages/torch/lib/libtorch_python.so
#19 0x0000555bedf0d964 in cfunction_call () at /tmp/build/80754af9/python-split_1629314979626/work/Objects/methodobject.c:539
#20 0x0000555bedf07c0f in _PyObject_MakeTpCall () at /tmp/build/80754af9/python-split_1629314979626/work/Objects/call.c:191
#21 0x0000555bedf97789 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x555bf2271418, callable=<optimized out>, tstate=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:116
#22 PyObject_Vectorcall () at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:127
#23 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x555bef577810) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:5072
#24 _PyEval_EvalFrameDefault () at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:3487
#25 0x0000555bedf4d552 in _PyEval_EvalFrame () at /tmp/build/80754af9/python-split_1629314979626/work/Include/internal/pycore_ceval.h:40
#26 _PyEval_EvalCode () at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:4327
#27 0x0000555bedf4e0b7 in _PyFunction_Vectorcall () at /tmp/build/80754af9/python-split_1629314979626/work/Objects/call.c:396
#28 0x0000555bedec6336 in _PyObject_VectorcallTstate (kwnames=0x7f87b4b1dfa0, nargsf=<optimized out>, args=<optimized out>, callable=0x7f87b4b2d550, tstate=<optimized out>)
    at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:118
#29 PyObject_Vectorcall () at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:127
#30 call_function (kwnames=0x7f87b4b1dfa0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:5072
#31 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x555bf226e6f0, throwflag=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:3535
#32 0x0000555bedf4d74b in _PyEval_EvalFrame () at /tmp/build/80754af9/python-split_1629314979626/work/Include/internal/pycore_ceval.h:40
#33 _PyEval_EvalCode () at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:4327
#34 0x0000555bedf4e0b7 in _PyFunction_Vectorcall () at /tmp/build/80754af9/python-split_1629314979626/work/Objects/call.c:396
#35 0x0000555bedec6ff4 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x555bf226e698, callable=0x7f87b4b2d940, tstate=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:118
#36 PyObject_Vectorcall () at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:127
#37 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x555bef577810) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:5072
#38 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x555bf226e4a0, throwflag=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:3487
#39 0x0000555bedf4d552 in _PyEval_EvalFrame () at /tmp/build/80754af9/python-split_1629314979626/work/Include/internal/pycore_ceval.h:40
#40 _PyEval_EvalCode () at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:4327
#41 0x0000555bedf4e0b7 in _PyFunction_Vectorcall () at /tmp/build/80754af9/python-split_1629314979626/work/Objects/call.c:396
#42 0x0000555bedec6336 in _PyObject_VectorcallTstate (kwnames=0x7f883a6eb4f0, nargsf=<optimized out>, args=<optimized out>, callable=0x7f87b4b2de50, tstate=<optimized out>)
    at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:118
#43 PyObject_Vectorcall () at /tmp/build/80754af9/python-split_1629314979626/work/Include/cpython/abstract.h:127
#44 call_function (kwnames=0x7f883a6eb4f0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:5072
#45 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x555bef5cfd80, throwflag=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:3535
#46 0x0000555bedf4d552 in _PyEval_EvalFrame () at /tmp/build/80754af9/python-split_1629314979626/work/Include/internal/pycore_ceval.h:40
#47 _PyEval_EvalCode () at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:4327
#48 0x0000555bedffcfcc in _PyEval_EvalCodeWithName (qualname=0x0, name=0x0, closure=0x0, kwdefs=0x0, defcount=0, defs=0x0, kwstep=2, kwcount=0, kwargs=<optimized out>, kwnames=<optimized out>, argcount=<optimized out>, args=<optimized out>, 
    locals=<optimized out>, globals=<optimized out>, _co=<optimized out>) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:4359
#49 PyEval_EvalCodeEx () at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:4375
#50 0x0000555bedf4e57b in PyEval_EvalCode (co=co@entry=0x7f883a5b8190, globals=globals@entry=0x7f883a684b00, locals=locals@entry=0x7f883a684b00) at /tmp/build/80754af9/python-split_1629314979626/work/Python/ceval.c:826
#51 0x0000555bedffd07b in run_eval_code_obj () at /tmp/build/80754af9/python-split_1629314979626/work/Python/pythonrun.c:1219
#52 0x0000555bee0334d5 in run_mod () at /tmp/build/80754af9/python-split_1629314979626/work/Python/pythonrun.c:1240
#53 0x0000555beded9f34 in pyrun_file (fp=0x555bef5ada10, filename=0x7f883a64d6b0, start=257, globals=0x7f883a684b00, locals=0x7f883a684b00, closeit=1, flags=0x7ffd6d8540f8) at /tmp/build/80754af9/python-split_1629314979626/work/Python/pythonrun.c:1138
#54 0x0000555bee0381cf in pyrun_simple_file (flags=0x7ffd6d8540f8, closeit=1, filename=0x7f883a64d6b0, fp=0x555bef5ada10) at /tmp/build/80754af9/python-split_1629314979626/work/Python/pythonrun.c:449
#55 PyRun_SimpleFileExFlags () at /tmp/build/80754af9/python-split_1629314979626/work/Python/pythonrun.c:482
#56 0x0000555bee0382eb in PyRun_AnyFileExFlags () at /tmp/build/80754af9/python-split_1629314979626/work/Python/pythonrun.c:91
#57 0x0000555bee03891c in pymain_run_file (cf=0x7ffd6d8540f8, config=0x555bef576300) at /tmp/build/80754af9/python-split_1629314979626/work/Modules/main.c:379
@pmeier
Copy link
Collaborator

pmeier commented Feb 21, 2023

Since we only excluded 3.9 explicitly (which was the latest supported Python version at the time)

vision/setup.py

Line 353 in 13755c9

if sys.platform != "linux" or (sys.version_info.major == 3 and sys.version_info.minor == 9):

3.10 will be build against ffmpeg. So far there are no issues: #7295. So I guess, we can lift at least the version restriction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants