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

Signals might be processed in wrong order in QtDBus

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2
    • D-Bus
    • None
    • x86_64, Linux Ubuntu 18.04, g++ 8.4.0
    • All

    Description

      Hi Qt-Team,

      I discovered a potential issue in QtDBus. When signals are sent via DBus and dispatching is still disabled on the receiver side, the signals are queued. Later, when QDBusConnectionPrivate::doDispatch is called and dispatching is enabled, first currently incoming messages are processed before queued messages are handled. This can lead to a reordering of incoming signals. Wouldn't it be better to first handle queued messages before processing incoming messages?

      Please find attached a small example program that demonstrates the issue. Since it depends on the timing of the application several runs might be needed before the issue occurs. Here are two example runs. In the first run everything is ok, in the second run the signals were processed in the wrong order:

       

      Received test signal 0.
      Received test signal 1.
      Received test signal 2.
      Received test signal 3.
      Received test signal 4.
      Received test signal 5.
      Received test signal 6.
      Received test signal 7.
      Received test signal 8.
      Received test signal 9.
      Received test signal 10.
      Received test signal 11.
      Received test signal 12.
      Received test signal 13.
      Received test signal 14.
      Received test signal 15.
      Received test signal 16.
      Received test signal 17.
      Received test signal 18.
      Received test signal 19.

      and

      Received test signal 6.
      Received test signal 7.
      Received test signal 8.
      Received test signal 9.
      Received test signal 10.
      Received test signal 11.
      Received test signal 12.
      Received test signal 13.
      Received test signal 14.
      Received test signal 15.
      Received test signal 16.
      Received test signal 17.
      Received test signal 18.
      Received test signal 19.
      Received test signal 0.
      Received test signal 1.
      Received test signal 2.
      Received test signal 3.
      Received test signal 4.
      Received test signal 5.

      Attachments

        1. Signals.h
          0.2 kB
        2. Signals.cpp
          1 kB

        Activity

          People

            Unassigned Unassigned
            pascal.weisser Pascal Weisser
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: