VirtualBox

Opened 11 years ago

Closed 11 years ago

#12379 closed defect (fixed)

API : ISnapshotEvent throw exception on getting Snapshot UUID

Reported by: Max D Owned by:
Component: webservices Version: VirtualBox 4.3.2
Keywords: Cc:
Guest type: all Host type: Linux

Description

While using the Java WebService API to work with Snapshot, I am unable to use the generated event objects. Any attempt to lookup the snapshot UUID will result in an exception.

I have attached the code to reproduce the issue with version 4.3.2 and 4.2.18 (each a specific Java file). My code assume that the web service is configured with null authentication.

4.2 Host

root@HB-Wheezy-4-2:~# uname -a
Linux HB-Wheezy-4-2 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
root@HB-Wheezy-4-2:~# java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1~deb7u1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
root@HB-Wheezy-4-2:~#

4.3 Host

root@HB-Wheezy-4-3:~# uname -a
Linux HB-Wheezy-4-3 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
root@HB-Wheezy-4-3:~# java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1~deb7u1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
root@HB-Wheezy-4-3:~#

The output for 4.3.2 :

VBox Version : 4.3.2 r90405
Skipping OnEventSourceChanged
Skipping OnMachineDataChanged
Skipping OnMachineStateChanged
Skipping OnMachineStateChanged
Skipping OnMachineDataChanged
org.virtualbox_4_3.VBoxException: VirtualBox error: Invalid managed object reference "7ba86778269d3cf5-0000000000000078"
	at org.virtualbox_4_3.ISnapshotEvent.getSnapshotId(ISnapshotEvent.java:54)
	at VBDebug_4_3.main(VBDebug_4_3.java:48)
Caused by: org.virtualbox_4_3.jaxws.InvalidObjectFaultMsg: VirtualBox error: Invalid managed object reference "7ba86778269d3cf5-0000000000000078"
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
	at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
	at $Proxy33.iSnapshotEventGetSnapshotId(Unknown Source)
	at org.virtualbox_4_3.ISnapshotEvent.getSnapshotId(ISnapshotEvent.java:49)
	... 1 more
Skipping OnSessionStateChanged
Deleted VM

The output for 4.2.18 :

VBox Version : 4.2.18 r88780
Skipping OnEventSourceChanged
Skipping OnMachineDataChanged
Skipping OnMachineStateChanged
Skipping OnMachineStateChanged
Skipping OnMachineDataChanged
org.virtualbox_4_2.VBoxException: VirtualBox error: Invalid managed object reference "1bf581ecb2941a09-000000000000283e"
	at org.virtualbox_4_2.ISnapshotEvent.getSnapshotId(ISnapshotEvent.java:47)
	at VBDebug_4_2.main(VBDebug_4_2.java:48)
Skipping OnSessionStateChanged
Deleted VM

Attachments (3)

VBDebug_4_3.java (2.6 KB ) - added by Max D 11 years ago.
4.3 Code
VBDebug_4_2.java (2.6 KB ) - added by Max D 11 years ago.
4.2 Code
vboxwrv.log (47.0 KB ) - added by Max D 11 years ago.

Download all attachments as: .zip

Change History (10)

by Max D, 11 years ago

Attachment: VBDebug_4_3.java added

4.3 Code

by Max D, 11 years ago

Attachment: VBDebug_4_2.java added

4.2 Code

by Max D, 11 years ago

Attachment: vboxwrv.log added

comment:1 by Max D, 11 years ago

vboxwrv.log attached, being -v on the web service. The error in java was

org.virtualbox_4_3.VBoxException: VirtualBox error: Invalid managed object reference "bdff369b3a031f29-000000000000000d"

comment:2 by Klaus Espenlaub, 11 years ago

Can't be your fault, managed to get this reproduced with the python webservice binding and a bit of hacking around in vboxshell.py. The beauty of using python is that I can easily run the very same code against the C++ API, and then it works perfectly.

So there must be a bug in the webservice somewhere, when dealing with the interface queries.

comment:3 by Max D, 11 years ago

Thank you for checking. My current workarounds are either to rely on the IMachineDataChangedEvent, which also occurs when Snapshot information changes, or to create a custom event which informs that snapshot data has changed, but without given any precission on the snapshot ID.
Both cases mean a full reload on the snapshot data, but is the best option for now.

comment:4 by Klaus Espenlaub, 11 years ago

This turned out to be a bug in the code generator for the events. For the more deeply nested VMs it produced a bogus list of implemented interfaces, resulting in this error. The bug is very old (the event code generation was added in 4.0), and this means that any released VirtualBox version since then is affected. There is no reasonable workaround possible, as the server component metadata is busted.

comment:5 by Max D, 11 years ago

Thank you for the follow up.

In the meantime, for those in need of a workaround outside of the Virtualbox API, I have created a more specific event for my use, at the same level as IMachineDataChanged, which would correspond to IMachineSnapshotChanged if you would implement it into VB. This class doesn't have any snapshot ID, only a machine ID.
The event basically means "Something about Snapshots changed for the VM, don't know what, do a full refresh".

I handle this lack of data at the bridge between the API & my own abstracted code. Once it is fixed on your side, I won't rely on my custom event anymore.

comment:6 by Klaus Espenlaub, 11 years ago

The fix will be in the next 4.3 and 4.2 maintenance release. As we can't change already released packages it might be a good idea (once you enabled the code) to blacklist the affected releases in your client, refusing to talk to broken versions.

Really annoying that this bug survived for over 3 years without anyone spotting it, because it's crippling the webservice interfaces more than I would've thought possible. The webservice bindings (Java, Python, ...) automatically works out the interface, and that means it'll pick ISnapshotEvent for the methods/attributes which are added there, no matter what interface type the client code actually uses.

The workaround which is available to C++ API clients (asking for the extended interface, e.g. ISnapshotTakenEvent) therefore won't help.

comment:7 by Frank Mehnert, 11 years ago

Resolution: fixed
Status: newclosed

Fixed in 4.3.4 and 4.2.20.

Note: See TracTickets for help on using tickets.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette