Libvir JNA report SIGSEGV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

  I try to verify the JNA with concurrent situation but meet some problems. The following is my example code:

    public static void testcase1() throws LibvirtException

    {

        Connect conn=null;

        Connect conn1=null;

        

        //connect to the hypervisor

        conn = new Connect("esx://10.74.125.68:443/?no_verify=1&transport=https", new ConnectAuthDefault(), 0);

        System.out.println(conn.getVersion());

       

        //connect to the hypervisor

        conn1 = new Connect("esx://10.74.125.90:443/?no_verify=1&transport=https", new ConnectAuthDefault(), 0);

        System.out.println(conn1.getVersion());

       

        

        while(true)

        {

                int[] array = new int[100000000];

                Long version = conn.getVersion();

                Long version1 = conn1.getVersion();

               

                try

                {

                         Thread.sleep(1000);

                }

                catch(Exception e)

                {

                }

        }

}

 

When I add line “int[] array = new int[100000000]”, then the following error will be generated very quickly:

# An unexpected error has been detected by Java Runtime Environment:

#

#  SIGSEGV (0xb) at pc=0x0000003f9b07046e, pid=30049, tid=1109510464

#

# Java VM: OpenJDK 64-Bit Server VM (1.6.0-b09 mixed mode linux-amd64)

# Problematic frame:

# C  [libc.so.6+0x7046e]

#

# An error report file with more information is saved as:

 

I have tried to write the similar code as following. It works well.

static void virXenBasic_TC001(void)

{

    virConnectPtr conn = NULL;

    virConnectPtr conn1 = NULL;

    unsigned long version = 0;

    unsigned long version1 = 0;

    char *hostname = NULL;

 

    conn = virConnectOpenAuth("esx://10.74.125.21/?no_verify=1", virConnectAuthPtrDefault, 0);

    if (conn == NULL) {

        fprintf(stderr, "Failed to open connection to qemu:///system\n");

        return;

    }

 

    conn1 = virConnectOpenAuth("esx://192.168.119.40/?no_verify=1", virConnectAuthPtrDefault, 0);

    if (conn1 == NULL) {

        fprintf(stderr, "Failed to open connection to qemu:///system\n");

        return;

    }

 

    while(true)

    {

        hostname = malloc(sizeof(char) * 100000000);

        virConnectGetVersion(conn, &version);

        virConnectGetVersion(conn, &version1);

        free(hostname);

        sleep(1);

    }

    return;

}

 

B.R.

Benjamin Wang

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]