Opened 4 years ago
Tracker deadlock between FS unmount and DoPeriodicUpdate
|Reported by:||mmlr||Owned by:||nobody|
|Has a Patch:||no||Platform:||All|
Periodic update BPose's are ones that get updated periodically through TTracker::Pulse() like the volume icons on the desktop with their free space bars. They are kept in a list managed by a global PeriodicUpdatePoses object.
TTracker::Pulse() calls PeriodicUpdatePoses::DoPeriodicUpdate() (Utilities.cpp:222) which locks the PeriodicUpdatePoses object and then locks the looper of each BPoseView where a BPose is to be updated.
When a volume is unmounted the FS notification triggers the BPose representing the volume on the desktop to be removed and destroyed. The BPose destructor then removes itself from the list via PeriodicUpdatePoses::RemovePose() (Utilities.cpp:200). This goes through the list and when it finds the item, it locks the object and removes the BPose. Locking is broken because items are added to the list without locking and the list traversal on remove doesn't happen locked. This should be fixed as well but doesn't affect the deadlock here.
The deadlock happens when DoPeriodicUpdate already holds the lock of PeriodicUpdatePoses but hasn't yet locked the looper of the BPoseView while the FS notification is handled (which means the looper is locked) but hasn't yet caused PeriodicUpdatePoses::RemovePose() to be called.
Attached is a KDL session showing more details. As I am tracking other issues currently and am unsure how this could be fixed cleanly, I'll leave this here without intention of fixing it myself.