Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
-
x86_64, Linux Ubuntu 18.04, g++ 8.4.0
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.