Ticket #13801 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Save settings deadlock

Reported by: a.urakov Owned by:
Component: other Version: VirtualBox 4.3.20
Keywords: save, settings, deadlock, media Cc:
Guest type: all Host type: Linux


There is possible deadlock on medium access when different machines save their settings. Deadlock occurs when these machines are commiting medias and saving modified registries at the same time.

In our case there are two machines (1 and 2) cloned with link option from common machine. We take snapshots of machines at the same time. So machine 1 saves modified registries (VirtualBox::saveModifiedRegistries()) for machine common (because information about 1 medias is saved in common settings due to linked cloning). Eventually it calls VirtualBox::saveMediaRegistry() which holds read lock on common medium and calls Medium::saveSettings() for every children. This recurses through all children mediums of common and holds read locks on all current recursion branch. So it tries to get read lock on 2 medium.

At the same time machine 2 commits media (Machine::commitMedia()). When it converts implicit attachment to normal it holds write lock on parent medium (the same medium thread 1 waits for) and tries to unlock all locked by session mediums (here I mean IMedium API-level locking, not object locking). Unlock procedure MediumLockList::Unlock() eventually calls Medium::unlockRead() for each medium in locked list (and common medium too). Medium::unlockRead() tries to get common medium write lock so threads are deadlocked.

Thank you in advance!


backtrace.log Download (10.3 KB) - added by a.urakov 8 years ago.
Here is backtrace log of deadlocked threads

Change History

Changed 8 years ago by a.urakov

Here is backtrace log of deadlocked threads

comment:1 Changed 8 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed

Fix is part of VBox 4.3.22.

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use