[libvirt] Libvir JNA report SIGSEGV

Benjamin Wang (gendwang) gendwang at cisco.com
Mon Sep 10 06:29:20 UTC 2012


Hi,
    The problem is located. The root cause is that esxConnectToHost/esxConnectToVCenter method defined in esx_driver.c will collect the username and password. JNA will allocate the memory for username and password. But esxConnectToHost/esxConnectToVCenter will free the memory allocated by Java as following defined in esxConnectToHost/esxConnectToVCenter:

VIR_FREE(username);
VIR_FREE(unescapedPassword);

When JVM run the GC, it will crash because of dual free. If I comment these two lines, the system works well. But I think this is not a good solution. What about your opinion?

B.R.
Benjamin Wang




-----Original Message-----
From: Benjamin Wang (gendwang) 
Sent: 2012年9月6日 21:43
To: 'veillard at redhat.com'
Cc: libvir-list at redhat.com
Subject: RE: [libvirt] Libvir JNA report SIGSEGV

Hi,
   I have looked into the code for several days. But I didn't find the root cause. Because even if I only call "new Connect", the problem will occur. So this should be related to Connect.java or ConnectAuthDefault.java. Would you take a quick at the issue and give some prompt?
Then I can try to fix this. Thanks!

B.R.
Benjamin Wang

-----Original Message-----
From: Daniel Veillard [mailto:veillard at redhat.com]
Sent: 2012年9月6日 19:05
To: Benjamin Wang (gendwang)
Cc: libvir-list at redhat.com
Subject: Re: [libvirt] Libvir JNA report SIGSEGV

On Thu, Sep 06, 2012 at 09:06:14AM +0000, Benjamin Wang (gendwang) wrote:
> Hi,
>   Actually I also did another test as following. When I comment the 
> "new Connet", the program works well. So this is the problem related 
> to Libvirt JNA. If I manually run the garbage collection for this program, it still works well. But if I run the garbage collection for the last problem, It will crash. I guess this problem is caused by ConnectAuth callback. When garbage collection is executed, the callback memory is moved.

  Okay, maybe some memory need to be pinned in some ways, I take patches !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list