Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Application randomly crashes on segmentation fault.
Forum Updated to NodeBB v4.3 + New Features

Application randomly crashes on segmentation fault.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hudek
    wrote on 2 Jul 2020, 11:52 last edited by
    #1

    Hello guys,

    when running a qt5 app it sometimes crashes on segmentation fault. This happens on random places in application and I have not been able to pinpoint why. I went forward to debugging it with gdc and got this output:

    Program received signal SIGSEGV, Segmentation fault.
    0xb5dd2580 in QV4::QObjectWrapper::wrap(QV4::ExecutionEngine*, QObject*) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    (gdb) bt
    #0 0xb5dd2580 in QV4::QObjectWrapper::wrap(QV4::ExecutionEngine*, QObject*) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #1 0xb5dcd2f4 in QV4::ExecutionEngine::fromVariant(QVariant const&) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #2 0xb5e184c5 in QV4::QmlContextWrapper::get(QV4::Managed const*, QV4::String*, bool*) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #3 0xb5dd63a1 in QV4::ExecutionContext::getProperty(QV4::String*) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #4 0xb5e6a962 in QV4::Runtime::method_getActivationProperty(QV4::ExecutionEngine*, int) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #5 0xac7e1d9d in ?? ()
    #6 0xb5dd76e9 in QV4::ExecutionContext::simpleCall(QV4::Scope&, QV4::CallData*, QV4::Function*) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #7 0xb5f0d8ce in QQmlJavaScriptExpression::evaluate(QV4::CallData*, bool*, QV4::Scope&) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #8 0xb5e9f73f in QQmlBoundSignalExpression::evaluate(void**) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #9 0xb5ea08d1 in ?? () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #10 0xb5ee92a2 in QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #11 0xb5e81638 in QQmlData::signalEmitted(QAbstractDeclarativeData*, QObject*, int, void**) () from /usr/share/qt5.9.6/lib/libQt5Qml.so.5
    #12 0xb57ada54 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #13 0xb57ae4db in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #14 0xaa095ac5 in QQuickWebView::urlChanged() () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #15 0xaa098f54 in QQuickWebView::emitUrlChangeIfNeeded() () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #16 0xaa09c4f1 in QQuickWebViewPrivate::didStartProvisionalLoadForFrame(OpaqueWKPage const*, OpaqueWKFrame const*, void const*, void const*) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #17 0xa9fcb06e in WebKit::WebLoaderClient::didStartProvisionalLoadForFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::APIObject*) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #18 0xa9fee1d3 in WebKit::WebPageProxy::didStartProvisionalLoadForFrame(unsigned long long, WTF::String const&, WTF::String const&, CoreIPC::MessageDecoder&) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #19 0xaa0d0754 in void CoreIPC::handleMessageVariadic<Messages::WebPageProxy::DidStartProvisionalLoadForFrame, WebKit::WebPageProxy, void (WebKit::WebPageProxy::)(unsigned long long, WTF::String const&, WTF::String const&, CoreIPC::MessageDecoder&)>(CoreIPC::MessageDecoder&, WebKit::WebPageProxy, void (WebKit::WebPageProxy::)(unsigned long long, WTF::String const&, WTF::String const&, CoreIPC::MessageDecoder&)) ()
    from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #20 0xaa0dae8b in WebKit::WebPageProxy::didReceiveMessage(CoreIPC::Connection
    , CoreIPC::MessageDecoder&) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #21 0xa9f2416b in CoreIPC::MessageReceiverMap::dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #22 0xa9f3f35e in WebKit::ChildProcessProxy::dispatchMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #23 0xa9ff582e in WebKit::WebProcessProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #24 0xa9f1e73c in CoreIPC::Connection::dispatchMessage(WTF::PassOwnPtrCoreIPC::MessageDecoder) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #25 0xa9f1e89d in CoreIPC::Connection::dispatchOneMessage() () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #26 0xa9f1d692 in WTF::BoundFunctionImpl<WTF::FunctionWrapper<void (CoreIPC::Connection::)()>, void (CoreIPC::Connection)>::operator()() () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #27 0xaa3a238c in WebCore::RunLoop::performWork() () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #28 0xaa476a37 in WebCore::RunLoop::TimerObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/share/qt5.9.6/qml/QtWebKit/../../lib/libQt5WebKit.so.5
    #29 0xb57aadeb in QMetaCallEvent::placeMetaCall(QObject*) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #30 0xb57af2bd in QObject::event(QEvent*) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #31 0xb66bf22c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/share/qt5.9.6/lib/libQt5Widgets.so.5
    #32 0xb66c6d24 in QApplication::notify(QObject*, QEvent*) () from /usr/share/qt5.9.6/lib/libQt5Widgets.so.5
    #33 0xb577f3f3 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #34 0xb5781c3c in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #35 0xb57d5a55 in QEventDispatcherUNIX::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #36 0xb346e2a5 in ?? () from /usr/share/qt5.9.6/plugins/platforms/../../lib/libQt5XcbQpa.so.5
    #37 0xb577cea9 in QEventLoop::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #38 0xb577d304 in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #39 0xb57864a9 in QCoreApplication::exec() () from /usr/share/qt5.9.6/lib/libQt5Core.so.5
    #40 0xb6125ef4 in QGuiApplication::exec() () from /usr/share/qt5.9.6/lib/libQt5Gui.so.5
    #41 0xb66bf184 in QApplication::exec() () from /usr/share/qt5.9.6/lib/libQt5Widgets.so.5
    #42 0x08060468 in main ()

    Anyone has any idea what could this be caused by?
    Thanks.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Cobra91151
      wrote on 2 Jul 2020, 18:29 last edited by
      #2

      Hello!

      Add the code below in your main.cpp and run the application in a debug mode:

      Code:

      #ifdef QT_DEBUG
          qputenv("QT_FATAL_WARNINGS", "1");
          qputenv("QT_MESSAGE_PATTERN",
                  "Type: %{type}\nProduct Name: %{appname}\nFile: %{file}\nLine: %{line}\nMethod: %{function}\nThreadID: %{threadid}\nThreadPtr: %{qthreadptr}\nMessage: %{message}");
      #endif
      

      OR

      #ifdef QT_DEBUG
          qputenv("QT_FATAL_WARNINGS", "1");
          qSetMessagePattern("Type: %{type}\nProduct Name: %{appname}\nFile: %{file}\nLine: %{line}\nMethod: %{function}\nThreadID: %{threadid}\nThreadPtr: %{qthreadptr}\nMessage: %{message}");
      #endif
      

      It should display more information about the crashes. Happy coding!

      J 1 Reply Last reply 2 Jul 2020, 18:35
      2
      • C Cobra91151
        2 Jul 2020, 18:29

        Hello!

        Add the code below in your main.cpp and run the application in a debug mode:

        Code:

        #ifdef QT_DEBUG
            qputenv("QT_FATAL_WARNINGS", "1");
            qputenv("QT_MESSAGE_PATTERN",
                    "Type: %{type}\nProduct Name: %{appname}\nFile: %{file}\nLine: %{line}\nMethod: %{function}\nThreadID: %{threadid}\nThreadPtr: %{qthreadptr}\nMessage: %{message}");
        #endif
        

        OR

        #ifdef QT_DEBUG
            qputenv("QT_FATAL_WARNINGS", "1");
            qSetMessagePattern("Type: %{type}\nProduct Name: %{appname}\nFile: %{file}\nLine: %{line}\nMethod: %{function}\nThreadID: %{threadid}\nThreadPtr: %{qthreadptr}\nMessage: %{message}");
        #endif
        

        It should display more information about the crashes. Happy coding!

        J Offline
        J Offline
        JonB
        wrote on 2 Jul 2020, 18:35 last edited by JonB 7 Feb 2020, 18:37
        #3

        @Cobra91151
        In that case, can't the first one be done just by setting the environment variables and running the application, without code changing/recompiling?

        Oh, do you mean the OP will need to recompile to have a debug version?

        C 1 Reply Last reply 2 Jul 2020, 18:48
        0
        • J JonB
          2 Jul 2020, 18:35

          @Cobra91151
          In that case, can't the first one be done just by setting the environment variables and running the application, without code changing/recompiling?

          Oh, do you mean the OP will need to recompile to have a debug version?

          C Offline
          C Offline
          Cobra91151
          wrote on 2 Jul 2020, 18:48 last edited by
          #4

          @JonB

          It is better to run this code in a debug mode. Running in a release mode could display different results.

          1 Reply Last reply
          1
          • H Offline
            H Offline
            Hudek
            wrote on 3 Jul 2020, 11:47 last edited by
            #5

            Thanks for the reply, I'll give it a try.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              davidcastagnetoa
              wrote on 25 Nov 2023, 20:02 last edited by
              #6

              I have had the same error with the same library "libQt5Qml.so.5". I have tried various alternatives, and in my case, that error occurred when I executed a function in QML, which was supposed to create a custom component previously created in another directory, inside main.qml. In the end, the only thing that solved the problem was migrating to QT6. In my case, I was using Python, so switching from PySide2 to PySide6 solved the problem. Try using QT6 instead of QT5. Good luck

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved