Results 1 to 2 of 2

Thread: Confusing bug with threaded application

  1. #1
    Join Date
    Oct 2009
    Posts
    33
    Thanks
    2

    Default Confusing bug with threaded application

    Hey all,

    I'm using QThreads in my application. At some points during my program, I enable and disable signals by calling (blockSignals(bool)) on objects that signal the threads. In one particular case, I unblock an object communicating with one of my threads in this manner. After about a second, the application crashes. I verify that the signals *do* unblock, and the event processing loop of the thread continues for a few iterations before crashing. The specific error I receive is:

    terminate called after throwing an instance of 'std:ut_of_range'
    what(): basic_string::substr

    But this isn't referring my code (at least I don't think it is). After running a backtrace with gdb, I get something like:

    Qt Code:
    1. (gdb) backtrace
    2. #0 0xb7fe2422 in __kernel_vsyscall ()
    3. #1 0xb71954d1 in raise () from /lib/tls/i686/cmov/libc.so.6
    4. #2 0xb7198932 in abort () from /lib/tls/i686/cmov/libc.so.6
    5. #3 0xb73b04df in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
    6. #4 0xb73ae415 in ?? () from /usr/lib/libstdc++.so.6
    7. #5 0xb73ae452 in std::terminate() () from /usr/lib/libstdc++.so.6
    8. #6 0xb73ae50b in __cxa_rethrow () from /usr/lib/libstdc++.so.6
    9. #7 0xb753e6e2 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
    10. #8 0xb75692ca in ?? () from /usr/lib/libQtCore.so.4
    11. #9 0xb6fb3e78 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
    12. #10 0xb6fb7720 in ?? () from /lib/libglib-2.0.so.0
    13. #11 0xb6fb7853 in g_main_context_iteration () from /lib/libglib-2.0.so.0
    14. #12 0xb756902c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
    15. #13 0xb753cc79 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
    16. #14 0xb753d0ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
    17. #15 0xb744ab73 in QThread::exec() () from /usr/lib/libQtCore.so.4
    18. #16 0x0805acb9 in DeviceThread::run (this=0x81a4648) at AxisCouple.cpp:487
    19. #17 0xb744de32 in ?? () from /usr/lib/libQtCore.so.4
    20. #18 0xb73eb80e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
    21. #19 0xb72377ee in clone () from /lib/tls/i686/cmov/libc.so.6
    To copy to clipboard, switch view to plain text mode 

    The only relevant line in my code is:
    Qt Code:
    1. (gdb) frame 16
    2. #16 0x0805acb9 in DeviceThread::run (this=0x81a4648) at AxisCouple.cpp:487
    3. 487 exec();
    To copy to clipboard, switch view to plain text mode 

    I'm confused because I'm not calling exec(), or run() on the thread when it crashes. The thread is running when the program starts, and runs for quite awhile without issues. Only when I block objects talking to this thread, and then unblock them does this issue occur. I'm trying to figure out what the problem is... generally in multithreaded apps the problems are due to race conditions / thread safety etc. But I have no idea how to interpret the gdb output. I'd really appreciate any insight.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Confusing bug with threaded application

    Please show us your code. Especially the part where you block signals.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QSkinWindows Classes
    By kernel_panic in forum Qt-based Software
    Replies: 45
    Last Post: 20th April 2010, 12:35
  2. Replies: 1
    Last Post: 8th November 2009, 12:49
  3. Multi Threaded Client Server application
    By live_07 in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2009, 16:32
  4. Deploying Qt 4.5.1 Application on RHEL 5.. Pls Help
    By swamyonline in forum Installation and Deployment
    Replies: 0
    Last Post: 28th June 2009, 11:43
  5. dll + application
    By fpujol in forum Qt Programming
    Replies: 11
    Last Post: 15th April 2007, 18:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.