[libvirt] Java binding - JVM crashes .. sometimes

Hi, since I updated to the new libvirt-version (CVS snapshot of today), my JVM running my multi-thread application "sometimes" will crashes if I open or close libvirt-connection (on KVM hypervisor). I didn't find out the exact szenario - simple junit tests are running well. But inside my main application (multi tread, multiple fast access to libvirt java interface) will crash the JVM. The crash-report looks like ALWAYS like the following 2 examples. Is there a way to - debug this - make the JNI code more robust ? - make the open/close of libvirt more robust ? I think the JVM crashes, because the libvirt crashes. Is there a way to look inside libvirt to see a "crash" of the native libvirt-prog ? My application runs very well with the old version libvirt-0.4.5. I think, problem starts with >= 0.5. One more: Something, it happens, that a virsh -command on the commandline prints out an error message similar to "Can't connect to hypervisor" (I can't reproduce it at the moment). Multiple repeating the command works well. This happens not often - but sometimes.. Now, the Stacktrace of the crashed JVM ** first ... Instructions: (pc=0x0000000001206351) 0x0000000001206341: c0 48 83 c4 28 5b 41 5c 41 5d 41 5e 41 5f c9 c3 0x0000000001206351: 49 8b 3e e8 47 f7 fc ff 84 c0 74 18 48 8b 15 bc Stack: [0x0000000002430000,0x0000000002531000], sp=0x000000000252f0d0, free space=1020k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x34a351] V [libjvm.so+0x325201] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j org.libvirt.Connect._close(J)I+0 j org.libvirt.Connect.close()V+5 j org.libvirt.Connect.finalize()V+1 v ~StubRoutines::call_stub j java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0 j java.lang.ref.Finalizer.runFinalizer()V+45 j java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1 j java.lang.ref.Finalizer$FinalizerThread.run()V+11 v ~StubRoutines::call_stub ... ** Second ... Stack: [0x000000002a061000,0x000000002a162000], sp=0x000000002a15e050, free space=1012k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x34a351] V [libjvm.so+0x325201] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j org.libvirt.Connect._open(Ljava/lang/String;)J+0 j org.libvirt.Connect.<init>(Ljava/lang/String;Z)V+23 j de.dtnet.virtcontroller.server.command.VDomain.open(Ljava/lang/String;)Lorg/libvirt/Connect;+74 ... Viele Gruesse Daniel Schwager ------------------------------------------------------------------- DT Netsolution GmbH - Taläckerstr. 30 - D-70437 Stuttgart Geschäftsführer: Daniel Schwager, Stefan Hörz - HRB Stuttgart 19870 Tel: +49-711-849910-32, Fax: -932 - Mailto:daniel.schwager@dtnet.de

My application runs very well with the old version libvirt-0.4.5. I think, problem starts with >= 0.5.0
Some addition information: I tested the szenario also with 0.4.5 - but the JVM creashed also. Therefore, the difference of libvirt version's is to responsible for the crash. One more difference - the working szenario based on xen-hypervisor - the current (crashed JVM) szenario based on qemu (kvm-84) My connection qemu-URL inside the java code looks like qemu:///session (also tried system instead of session - what's the difference between system/session ?) regards Danny

One more: Something, it happens, that a virsh -command on the commandline prints out an error message similar to "Can't connect to hypervisor" (I can't reproduce it at the moment). Multiple repeating the command works well. This happens not often - but sometimes..
I got the error again: ** Error1 libvir: Remote Fehler : connection already open Fehler: Verbindung zum Hypervisor scheiterte ** Error2 libvir: Remote Fehler : no call waiting for reply with serial 0 Fehler: Verbindung zum Hypervisor scheiterte regards Danny [root@xen03 xx]# virsh list libvir: Remote Fehler : connection already open Fehler: Verbindung zum Hypervisor scheiterte [root@xen03 xx]# virsh list Id Name Status ---------------------------------- 11 POOL1-Pool-WinXP5-1234902964697-VM122 laufend 13 POOL1-Pool-WinXP5-1234902964697-VM127 laufend 14 POOL1-Pool-WinXP5-1234902964697-VM129 laufend [root@xen03 xx]# virsh list Id Name Status ---------------------------------- 11 POOL1-Pool-WinXP5-1234902964697-VM122 laufend 13 POOL1-Pool-WinXP5-1234902964697-VM127 laufend 14 POOL1-Pool-WinXP5-1234902964697-VM129 laufend [root@xen03 xx]# virsh list libvir: Remote Fehler : no call waiting for reply with serial 0 Fehler: Verbindung zum Hypervisor scheiterte [root@xen03 xx]# virsh list Id Name Status ---------------------------------- 11 POOL1-Pool-WinXP5-1234902964697-VM122 laufend 13 POOL1-Pool-WinXP5-1234902964697-VM127 laufend 14 POOL1-Pool-WinXP5-1234902964697-VM129 laufend 18 domain1234962052729 laufend 19 domain1234962449713 laufend

On Wed, Feb 18, 2009 at 02:28:27PM +0100, Daniel Schwager wrote:
One more: Something, it happens, that a virsh -command on the commandline prints out an error message similar to "Can't connect to hypervisor" (I can't reproduce it at the moment). Multiple repeating the command works well. This happens not often - but sometimes..
I got the error again:
** Error1 libvir: Remote Fehler : connection already open Fehler: Verbindung zum Hypervisor scheiterte
** Error2 libvir: Remote Fehler : no call waiting for reply with serial 0 Fehler: Verbindung zum Hypervisor scheiterte
These are bugs in 0.6.0 release - see this fix now in CVS http://www.redhat.com/archives/libvir-list/2009-February/msg00104.html Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Hi, i'm using the CVS-checkout from 20090217-1451 including the patches you refer to (I looked inside the code). But this error still happen sometimes .. regards Danny
** Error1 libvir: Remote Fehler : connection already open Fehler: Verbindung zum Hypervisor scheiterte
These are bugs in 0.6.0 release - see this fix now in CVS
http://www.redhat.com/archives/libvir-list/2009-February/msg00104.html

Hi, i think something is buggy with the function libvirt-java, Connect.close() (closing the connection to the libvirt daemon). I removed all the close() calls inside my prog and the JVM will not crash any more. My prog works now like it should... Maybe a bug ? Thx Danny ...
Instructions: (pc=0x0000000001206351) 0x0000000001206341: c0 48 83 c4 28 5b 41 5c 41 5d 41 5e 41 5f c9 c3 0x0000000001206351: 49 8b 3e e8 47 f7 fc ff 84 c0 74 18 48 8b 15 bc
Stack: [0x0000000002430000,0x0000000002531000], sp=0x000000000252f0d0, free space=1020k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x34a351] V [libjvm.so+0x325201]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j org.libvirt.Connect._close(J)I+0 j org.libvirt.Connect.close()V+5 j org.libvirt.Connect.finalize()V+1 v ~StubRoutines::call_stub j java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0 j java.lang.ref.Finalizer.runFinalizer()V+45 j java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1 j java.lang.ref.Finalizer$FinalizerThread.run()V+11 v ~StubRoutines::call_stub ...
participants (2)
-
Daniel P. Berrange
-
Daniel Schwager