Hi, I am using JNA 3.4.1. The problem is caused by libvirt java. You are right. B.R. Benjamin Wang -----Original Message----- From: Claudio Bley [mailto:cbley@xxxxxxxxxx] Sent: 2012年10月19日 19:36 To: Benjamin Wang (gendwang) Cc: libvir-list@xxxxxxxxxx; Guannan Ren; Daniel Veillard; Yang Zhou (yangzho) Subject: Re: JNA Error Callback could cause core dump. >>>>> "BW" == Benjamin Wang (gendwang) <gendwang@xxxxxxxxx> writes: BW> Hi, When I changed code as following: BW> public class Connect { BW> // Load the native part BW> static { BW> Libvirt.INSTANCE.virInitialize(); BW> try { BW> ErrorHandler.processError(Libvirt.INSTANCE); BW> } catch (Exception e) { BW> e.printStackTrace(); BW> } BW> + Libvirt.INSTANCE.virSetErrorFunc(null, new BW> ErrorCallback()); BW> } BW> The problem was caused that when JNA call setErrorFunc, it BW> will create ErrorCallback object. But when GC is executed, the BW> object is GCed. Yes, that's why you should keep a reference to the object around. BW> But even I change code as following. BW> When GC is excuted, the callback object will be moved. Then C BW> can’t find this object. Both of scenarios will cause core BW> dump. It seems that JNA mustn’t provide ErrorCallback Class, First off, JNA does not provide this class, it is provided by the libvirt-java wrapper. Which version of JNA did you use? As I said in a previous mail, I had crashes with JNA < 3.4.2. Consequently, I cannot reproduce the crash using your code, JNA 3.4.2 and with having this series (https://www.redhat.com/archives/libvir-list/2012-October/msg00578.html) applied. (at least patch #15 is needed when using JNA 3.4.2) -- AV-Test GmbH, Klewitzstr. 7, 39112 Magdeburg, Germany Phone: +49 391 6075466, Fax: +49 391 6075469 Web: <http://www.av-test.org> Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list