VirtualBox

Opened 13 years ago

Closed 8 years ago

#7722 closed defect (obsolete)

Assertion failed in Medium::markForDeletion when merging disks

Reported by: Sm0k1n Owned by:
Component: webservices Version: VirtualBox 3.2.8
Keywords: medium, merge, assertion, failed Cc:
Guest type: other Host type: Windows

Description (last modified by aeichner)

Whenever I attempt to merge two disks (a base disk and its only child) I get this exception:

org.virtualbox_3_2.RuntimeFaultMsg: VirtualBox error: Assertion failed: [this->lockHandle()->isWriteLockOnCurrentThread()] 
at 'D:\tinderbox\win-3.2\src\VBox\Main\MediumImpl.cpp' (4042) in Medium::markForDeletion. 
Please contact the product vendor! (0x80004005)

As far as I can tell, I have met all the requirements stated in the API docs for the IMedium::mergeTo() operation.

If it is of importance, the disks that are to be merged are both completely empty and I am using the jax-ws to write a servlet that does the merge.

Any ideas?

Attachments (1)

VBoxSVC.log.9 (2.5 KB ) - added by P.Pan 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Klaus Espenlaub, 13 years ago

What exactly are you doing? Not clear from your description, so I can't tell what's going on...

VirtualBox uses merging internally to implement snapshot deletion. This means the code works in principle. I wonder if you deliberately do something which isn't possible with snapshots or if you should rather be using snapshots.

I haven't seen real use cases for creating diff media in general and explicit merging in particular, which is the reason why VBoxManage doesn't offer these operations. Having everything wrapped up in a snapshot is easier to understand for both the developer and the user.

comment:2 by Sm0k1n, 13 years ago

Well, the disks I tested this on were a base disk and its child. I got the child by making the base disk immutable, attaching it to a vm then starting the vm. Automagically I got the diff child medium. I changed the base disk to normal and attempted the merge.

If it is relevant, the operations I perform to execute the merge are: IVirtualBox.getHardDisk() for both disk using their UUIDs, then I call sourceDisk.mergetTo(targetDisk).


An example of what I would like to do is the following: I have a web page (jsp) that displays a base medium and its five children in a linear chain (Base -> Child 1 - > Child 2 -> Child 3 -> Child 4 -> Child 5). A user selects disk 2 (source) and 4 (target), and clicks on a merge button somewhere on the page. All the disks between the source and the target get merged and the user ends up with something like this (Base -> Child 1 -> Merged Child -> Child 5).

At least this is the impression I got from the API docs for the way this function operates. As far as snapshots are concerned, I am not doing anything with them, this is just for hard disks.

comment:3 by Klaus Espenlaub, 13 years ago

Sounds like incorrect use of immutable media to me, but I didn't check the details. Immutable media are never writable, so at the moment I tend towards interpreting this as a case of a sub-optimal error message. In general, the isolated use of diff media is little tested, and you still didn't convince me that you shouldn't be using snapshots.

The method exists because it would be potentially useful if we found a use case for explicit diff image handling. Which we haven't found so far, as you can tell by looking at the VirtualBox GUI and CLI. Everything there is based on snapshots, and the diff images related to immutable media don't need special treatment as their handling is implicit in starting a VM.

by P.Pan, 12 years ago

Attachment: VBoxSVC.log.9 added

in reply to:  description comment:4 by P.Pan, 12 years ago

Hi,

my problem is related to this one, so I just post it here. I posted my problem already in the virtualbox forum (https://forums.virtualbox.org/viewtopic.php?f=7&t=46963) and to the mailing list. But there is no answer until now. I am just searching for some answer (could even be: "don't know").

Here is the description of the problem:

I am trying to communicate with VirtualBox using the Java API. My OS is Ubuntu and i working with VirtualBox 4.1.4 (i also tested the newest version).

Right now I am trying to merge differential Images. I use differential Images instead of the Snapshot functionality, because I can set the location of an IMedium directly (snapshots do not support this (only support of snapshot folder, but there is no way, that I know, to create a new vm attaching a saved base vdi and all snapshots - Assuming I deleted the old vm and saved the vdi and the snapshot files ) ). Moreover the machine settings are stored separately, so a differential image is enough.

I created a base hard disk with createBaseStorage. Then I opened this base hard disk and used createDiffStorage to create a differential image. Now I want to merge my base.vdi with the diff1.vdi (backward merge). So I used openMedium to open both vdis (first base.vdi (stored in IMedium base), second dif1.vdi (stored in IMedium diff1)). This is followed by this code:

       IProgress progress = diff1.mergeTo(base);
          progress.waitForCompletion(-1);

Here I get the following error:

Exception in thread "main" org.virtualbox_4_1.VBoxException: The function "mergeTo" returned an error condition: "Assertion failed: [this->lockHandle()->isWriteLockOnCurrentThread()] at '/home/vbox/vbox-4.1.4/src/VBox/Main/src-server/MediumImpl.cpp' (4285) in nsresult Medium::markForDeletion(). Please contact the product vendor!" (0x80004005)

All conditions of the method mergeTo are satisfied:

  • the mediums are not attached
  • they are not immutable
  • the chain is linear
  • medium state is not MediumState.LockedRead or MediumState.LockedWrite

Also the forward merge does not work.

comment:5 by aeichner, 8 years ago

Description: modified (diff)
Resolution: obsolete
Status: newclosed

Please reopen if still relevant with a recent VirtualBox release.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use