decord icon indicating copy to clipboard operation
decord copied to clipboard

Segmentation fault (core dumped) when using with PyQt5 in Linux

Open sowmen opened this issue 3 years ago • 1 comments

Running the code below causes Segmentation Fault in Linux, but runs without any issue in Windows.

Linux environment: OS: Ubuntu 20.04 kernel 5.11 CPU: Intel i9 12th gen

The decord package, pyqt5 and pyqt5-tools was installed using pip in a clean conda environment. Just importing decord causes seg fault.

import sys
from PyQt5.QtWidgets import QApplication

from decord import VideoReader

from PyQt5.QtWidgets import *
app = QApplication([])
window = QWidget()
layout = QVBoxLayout()
layout.addWidget(QPushButton('Top'))
layout.addWidget(QPushButton('Bottom'))
window.setLayout(layout)
window.show()
app.exec_()

Running the program in valgrind gives the following output

==32688== Process terminating with default action of signal 11 (SIGSEGV)
==32688==  Access not within mapped region at address 0x0
==32688==    at 0x132043E6: ??? (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/decord.libs/libxcb-77222338.so.1.1.0)
==32688==    by 0x13203F9A: xcb_send_request_with_fds64 (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/decord.libs/libxcb-77222338.so.1.1.0)
==32688==    by 0x13204118: xcb_send_request (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/decord.libs/libxcb-77222338.so.1.1.0)
==32688==    by 0x13212270: xcb_intern_atom (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/decord.libs/libxcb-77222338.so.1.1.0)
==32688==    by 0x34B198D3: QXcbAtom::initializeAllAtoms(xcb_connection_t*) (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5XcbQpa.so.5)
==32688==    by 0x34B0BF50: QXcbBasicConnection::QXcbBasicConnection(char const*) (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5XcbQpa.so.5)
==32688==    by 0x34AE2381: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5XcbQpa.so.5)
==32688==    by 0x34AE639B: QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**) (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5XcbQpa.so.5)
==32688==    by 0x348A271C: QXcbIntegrationPlugin::create(QString const&, QStringList const&, int&, char**) (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so)
==32688==    by 0x74015AA: QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char**, QString const&) (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5Gui.so.5)
==32688==    by 0x740E1D8: QGuiApplicationPrivate::createPlatformIntegration() (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5Gui.so.5)
==32688==    by 0x740F2AC: QGuiApplicationPrivate::createEventDispatcher() (in /home/sowmen/miniconda3/envs/boltuenv/lib/python3.8/site-packages/PyQt5/Qt5/lib/libQt5Gui.so.5)
==32688==  If you believe this happened as a result of a stack
==32688==  overflow in your program's main thread (unlikely but
==32688==  possible), you can try to increase the size of the
==32688==  main thread stack using the --main-stacksize= flag.
==32688==  The main thread stack size used in this run was 8388608.
==32688== 
==32688== HEAP SUMMARY:
==32688==     in use at exit: 6,836,725 bytes in 6,269 blocks
==32688==   total heap usage: 13,801 allocs, 7,532 frees, 22,439,515 bytes allocated
==32688== 
==32688== LEAK SUMMARY:
==32688==    definitely lost: 160 bytes in 3 blocks
==32688==    indirectly lost: 0 bytes in 0 blocks
==32688==      possibly lost: 187,800 bytes in 156 blocks
==32688==    still reachable: 6,648,765 bytes in 6,110 blocks
==32688==                       of which reachable via heuristic:
==32688==                         stdstring          : 2,444 bytes in 42 blocks
==32688==         suppressed: 0 bytes in 0 blocks
==32688== Rerun with --leak-check=full to see details of leaked memory
==32688== 
==32688== Use --track-origins=yes to see where uninitialised values come from
==32688== For lists of detected and suppressed errors, rerun with: -s
==32688== ERROR SUMMARY: 2804 errors from 159 contexts (suppressed: 22 from 2)
Segmentation fault (core dumped)

The error occurs from libxcb-77222338.so.1.1.0 package. But I have no idea how to proceed further than this.

sowmen avatar Feb 04 '22 18:02 sowmen

most likely conflicting version of ffmpeg, you can compile locally from source to get rid of statically linked ffmpeg

zhreshold avatar Feb 09 '22 02:02 zhreshold