Important: Please read the Qt Code of Conduct -

QTimer::timeout() randomly causes segmentation fault

  • Hi,

    My application has random crashes originating from QTimer::timeout(). The application may crash in minutes or may be running for days before crashing. Crash happens always in resetCurrentSender(). The timer in question (0x6a9106d8) is started once and left running with 50 ms interval.

    Does anyone have an idea what is going on?

    Backtrace from core dump:

    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  resetCurrentSender (currentSender=0x6b2feb28, 
        previousSender=0x7642a9f8 <QArrayData::shared_null>, 
        receiver=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qobject_p.h:272
    No locals.
    #1  ~QConnectionSenderSwitcher (this=0x6b2feb20, __in_chrg=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qobject.cpp:176
            this = 0x6b2feb20
    #2  QMetaObject::activate (sender=sender@entry=0x6a9106d8, 
        signalOffset=<optimized out>, 
        local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qobject.cpp:3704
            sw = {receiver = 0x6a910f90, 
              previousSender = 0x7642a9f8 <QArrayData::shared_null>, 
              currentSender = {sender = 0x6a9106d8, signal = 3, ref = 1}, 
              switched = true}
            callFunction = <optimized out>
            receiver = <optimized out>
            method_relative = <optimized out>
            c = 0x6a9106f8
            last = 0x6a9106f8
            locker = {val = 1985674457}
            connectionLists = {connectionLists = 0x6a905308}
            list = 0x6a905348
            signal_index = <optimized out>
            empty_argv = {0x0}
            currentThreadId = 0x6b2ff440
    #3  0x7637467a in QMetaObject::activate (sender=sender@entry=0x6a9106d8, 
        m=<optimized out>, local_signal_index=local_signal_index@entry=0, 
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qobject.cpp:3595
    No locals.
    #4  0x763ccef2 in QTimer::timeout (this=this@entry=0x6a9106d8)
        at .moc/moc_qtimer.cpp:198
    No locals.
    #5  0x7637bfd6 in QTimer::timerEvent (this=0x6a9106d8, e=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qtimer.cpp:247
            e = <optimized out>
            this = 0x6a9106d8
    #6  0x76374a40 in QObject::event (this=0x6a9106d8, e=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qobject.cpp:1278
    No locals.
    #7  0x76354000 in doNotify (event=<optimized out>, receiver=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qcoreapplication.cpp:1090
    No locals.
    #8  QCoreApplication::notify (this=<optimized out>, receiver=<optimized out>, 
        event=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qcoreapplication.cpp:1076
    No locals.
    #9  0x763540e0 in QCoreApplication::notifyInternal2 (receiver=0x6a9106d8, 
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qcoreapplication.cpp:1015
            result = false
            cbdata = {0x6a9106d8, 0x6b2fecd8, 0x6b2fec6b}
            d = <optimized out>
            threadData = 0x224b4f0
            loopLevelCounter = {threadData = 0x224b4f0}
    #10 0x7638f8e4 in sendEvent (event=0x6b2fecd8, receiver=<optimized out>)
        at ../../../git/src/corelib/kernel/qcoreapplication.h:225
    No locals.
    #11 QTimerInfoList::activateTimers (this=0x6a90289c)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qtimerinfo_unix.cpp:637
            e = {<QEvent> = {_vptr.QEvent = 0x765a3cf8 <vtable for QTimerEvent+8>, 
                static staticMetaObject = {d = {superdata = 0x0, 
                    stringdata = 0x7658abcc <qt_meta_stringdata_QEvent>, 
                    data = 0x7658a630 <qt_meta_data_QEvent>, 
                    static_metacall = 0x0, relatedMetaObjects = 0x0, 
                    extradata = 0x0}}, d = 0x0, t = 1, posted = 0, spont = 0, 
                m_accept = 1, reserved = 3410}, id = 5}
            currentTimerInfo = 0x6a906340
            n_act = 1
            maxCount = <optimized out>
            currentTime = {tv_sec = 1245200, tv_nsec = 303692}
    #12 0x7638fc5c in timerSourceDispatch (source=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qeventdispatcher_glib.cpp:176
            timerSource = <optimized out>
    #13 idleTimerSourceDispatch (source=<optimized out>)
        at /usr/src/debug/qtbase/5.6.0+gitAUTOINC+cec15a89d0-r0/git/src/corelib/kernel/qeventdispatcher_glib.cpp:223
            timerSource = <optimized out>
    #14 0x75bb9a10 in g_main_context_dispatch () from /usr/lib/
    No symbol table info available.
    #15 0x75bb9c38 in ?? () from /usr/lib/
    No symbol table info available.

  • Moderators

    It's possible it's a bug with timer dispatching. Can you prepare a minimal bare-bone example that'd reproduce this? What I mean to understand is if the problem might be connected to something in your code, although the stack trace doesn't suggest it. Also you could look at the bugtracker if something is known.

    Kind regards.

Log in to reply