Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-57013

[REG: 5.x - 4.x] Program hangs when plugging/unplugging usb devices if there are too many native widgets.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.9.2
    • 5.6.0, 5.7.0, 5.9
    • QPA: X11/XCB
    • None
    • Linux
      Ubuntu 14.04.4 LTS
      Ubuntu 16.04.1 LTS

    Description

      When plugging/unplugging usb devices, my program will hang for a while and come back later. The more widgets I add the much time it hangs.

      This issue happens if I add too many native widgets(by calling winId() or setAttribute(Qt::WA_NativeWindow)).

      It will work fine if I don't set them as native widgets.

      In the example program I put a clock to present it really hangs.
      You can see the clock stop running.

      I have only tested on Qt5.6.0 and Qt5.7.0.
      No idea whether this happens on other version.
      (No issue on Qt4.x)

      Here is the call stack trace while it's blocking.
      (Qt version: 5.7.0, Ubuntu 16.04.1 LTS, gcc version: 5.4.0, X.Org X Server 1.18.4)

      #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
      #1  0x00007fffeff94eb9 in _xcb_conn_wait (c=c@entry=0x630fb0, cond=cond@entry=0x7fffffffd200, vector=vector@entry=0x0, count=count@entry=0x0) at ../../src/xcb_conn.c:427
      #2  0x00007fffeff96617 in wait_for_reply (c=c@entry=0x630fb0, request=682647, e=e@entry=0x7fffffffd2d0) at ../../src/xcb_in.c:516
      #3  0x00007fffeff96721 in xcb_wait_for_reply (c=0x630fb0, request=682647, e=0x7fffffffd2d0) at ../../src/xcb_in.c:546
      #4  0x00007ffff0608a47 in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6
      #5  0x00007fffef23f32f in XIQueryDevice () from /usr/lib/x86_64-linux-gnu/libXi.so.6
      #6  0x00007ffff7ed15d6 in QXcbConnection::xi2SetupDevices (this=0x62f9e0) at qxcbconnection_xi2.cpp:117
      #7  0x00007ffff7ed5ca3 in QXcbConnection::xi2HandleHierachyEvent (this=0x62f9e0, event=0x9ed140) at qxcbconnection_xi2.cpp:831
      #8  0x00007ffff7ed3a4b in QXcbConnection::xi2HandleEvent (this=0x62f9e0, event=0x9ed140) at qxcbconnection_xi2.cpp:523
      #9  0x00007ffff7e90d7e in QXcbConnection::handleXcbEvent (this=0x62f9e0, event=0x9ed140) at qxcbconnection.cpp:1223
      #10 0x00007ffff7e929eb in QXcbConnection::processXcbEvents (this=0x62f9e0) at qxcbconnection.cpp:1735
      #11 0x00007ffff7ee108a in QXcbConnection::qt_static_metacall (_o=0x62f9e0, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffe4004a40) at .moc/moc_qxcbconnection.cpp:188
      #12 0x00007ffff7270d99 in QMetaCallEvent::placeMetaCall (this=0x7fffe4003b80, object=0x62f9e0) at kernel/qobject.cpp:502
      #13 0x00007ffff7271f63 in QObject::event (this=0x62f9e0, e=0x7fffe4003b80) at kernel/qobject.cpp:1263
      #14 0x00007ffff7e9408b in QXcbConnection::event (this=0x62f9e0, e=0x7fffe4003b80) at qxcbconnection.cpp:2351
      #15 0x00007ffff76d80ae in QApplicationPrivate::notify_helper (this=0x61dc50, receiver=0x62f9e0, e=0x7fffe4003b80) at kernel/qapplication.cpp:3799
      #16 0x00007ffff76d52fc in QApplication::notify (this=0x7fffffffe340, receiver=0x62f9e0, e=0x7fffe4003b80) at kernel/qapplication.cpp:3159
      #17 0x00007ffff723350b in QCoreApplication::notifyInternal2 (receiver=0x62f9e0, event=0x7fffe4003b80) at kernel/qcoreapplication.cpp:988
      #18 0x00007ffff723786e in QCoreApplication::sendEvent (receiver=0x62f9e0, event=0x7fffe4003b80) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
      #19 0x00007ffff7234a26 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x61ddc0) at kernel/qcoreapplication.cpp:1649
      #20 0x00007ffff723437c in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1503
      #21 0x00007ffff72b919d in postEventSourceDispatch (s=0x64d9c0) at kernel/qeventdispatcher_glib.cpp:276
      #22 0x00007ffff48c51a7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #23 0x00007ffff48c5400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #24 0x00007ffff48c54ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #25 0x00007ffff72b99a8 in QEventDispatcherGlib::processEvents (this=0x64da50, flags=...) at kernel/qeventdispatcher_glib.cpp:423
      #26 0x00007ffff7ee2452 in QPAEventDispatcherGlib::processEvents (this=0x64da50, flags=...) at eventdispatchers/qeventdispatcher_glib.cpp:121
      #27 0x00007ffff722fb48 in QEventLoop::processEvents (this=0x7fffffffe2c0, flags=...) at kernel/qeventloop.cpp:134
      #28 0x00007ffff722fe7f in QEventLoop::exec (this=0x7fffffffe2c0, flags=...) at kernel/qeventloop.cpp:210
      #29 0x00007ffff7233d01 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1261
      #30 0x00007ffff603ebf2 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1639
      #31 0x00007ffff76d4ca3 in QApplication::exec () at kernel/qapplication.cpp:2975
      #32 0x0000000000402fa0 in main (argc=1, argv=0x7fffffffe488) at test.cpp:42
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              paeglis Gatis Paeglis
              linnex linnex
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes