Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
5.3.0
-
None
Description
libdbus-1 has a recursive lock on its DBusConnection. When the signal arrives, the lock is acquired and the sginal handler is run. The signal handler can make DBus calls (which also require the lock) because the lock is recursive. QtDBus also has a lock that is always acquired before the libdbus-1 connection lock is acquired.
Unfortuntaely, the QtDBus lock is not acquired in the case of the incoming call from DBus – only the DBus lock is.
If another thread tries to do an unrelated DBus call meanwhile, it will acquire the QtDBus lock first and then the DBus lock (which is held because of the signal that arrived). Once the signal handler gets to the point of wanting to make a DBus call (in order to query the properties of the just-added network device) it will attempt to acquire the QtDBus lock. This is a lock-inversion deadlock.
QtDBus could be fixed in order to avoid this sort of lock inversion problem.