Skip to contentSkip to conversation

kvm process disappears

Qemu-devel Stefan Priebe - Profihost AG 4 participants 19 messages May 10, 2013 – May 28, 2013

lore
Share & tools
lore
#0 lore raw

Hello list,

i've now seen this several times. A VM is suddently down no segfault nothing the kvm process just disappears...

Anybody any idea how to debug this?

Sadly i can't reproduce. Qemu version is 1.4.1.

Greets Stefan

#1 lore raw

I never seen this, sorry ...

----- Mail original -----

De: "Stefan Priebe - Profihost AG" <[email protected]> À: [email protected], "qemu-devel" <[email protected]> Envoyé: Vendredi 10 Mai 2013 08:12:39
Objet: [pve-devel] kvm process disappears

Hello list,

i've now seen this several times. A VM is suddently down no segfault nothing the kvm process just disappears...

Anybody any idea how to debug this?

Sadly i can't reproduce. Qemu version is 1.4.1.

Greets Stefan
_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

#2 lore raw
In reply to Stefan Priebe - Profihost AG

Just an idea, maybe are you out of memory and process are killed ?

nothing in logs ?

----- Mail original -----

De: "Stefan Priebe - Profihost AG" <[email protected]> À: [email protected], "qemu-devel" <[email protected]> Envoyé: Vendredi 10 Mai 2013 08:12:39
Objet: [pve-devel] kvm process disappears

Hello list,

i've now seen this several times. A VM is suddently down no segfault nothing the kvm process just disappears...

Anybody any idea how to debug this?

Sadly i can't reproduce. Qemu version is 1.4.1.

Greets Stefan
_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

#3 lore raw

Am 10.05.2013 09:20, schrieb Alexandre DERUMIER:

Quoted 3 lines

Just an idea, maybe are you out of memory and process are killed ?

nothing in logs ?

140GB free mem.... also nothing in dmesg... which logs did you mean?

Stefan

Quoted 22 lines

----- Mail original -----

De: "Stefan Priebe - Profihost AG" <[email protected]> À: [email protected], "qemu-devel" <[email protected]> Envoyé: Vendredi 10 Mai 2013 08:12:39
Objet: [pve-devel] kvm process disappears

Hello list,

i've now seen this several times. A VM is suddently down no segfault nothing the kvm process just disappears...

Anybody any idea how to debug this?

Sadly i can't reproduce. Qemu version is 1.4.1.

Greets Stefan
_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

#4 lore raw
Quoted 1 line
Quoted 1 line

140GB free mem.... also nothing in dmesg... which logs did you mean?

I thinked of /var/log/messages, logs with OOM Killer. But seem to not be your case ;)

Do you use HA ?

----- Mail original -----

De: "Stefan Priebe - Profihost AG" <[email protected]> À: "Alexandre DERUMIER" <[email protected]>
Cc: [email protected], "qemu-devel" <[email protected]> Envoyé: Vendredi 10 Mai 2013 09:22:27
Objet: Re: [pve-devel] kvm process disappears

Am 10.05.2013 09:20, schrieb Alexandre DERUMIER:

Quoted 3 lines

Just an idea, maybe are you out of memory and process are killed ?

nothing in logs ?

140GB free mem.... also nothing in dmesg... which logs did you mean?

Stefan

Quoted 22 lines

----- Mail original -----

De: "Stefan Priebe - Profihost AG" <[email protected]> À: [email protected], "qemu-devel" <[email protected]> Envoyé: Vendredi 10 Mai 2013 08:12:39
Objet: [pve-devel] kvm process disappears

Hello list,

i've now seen this several times. A VM is suddently down no segfault nothing the kvm process just disappears...

Anybody any idea how to debug this?

Sadly i can't reproduce. Qemu version is 1.4.1.

Greets Stefan
_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

#5 lore raw

Am 10.05.2013 09:28, schrieb Alexandre DERUMIER:

Quoted 2 lines
Quoted 1 line
Quoted 1 line

140GB free mem.... also nothing in dmesg... which logs did you mean?

I thinked of /var/log/messages, logs with OOM Killer. But seem to not be your case ;)

Nothing...

Quoted 1 line

Do you use HA ?

No

Stefan

#6 lore raw
In reply to Stefan Priebe - Profihost AG
Quoted 6 lines · Stefan Priebe - Profihost AG

i've now seen this several times. A VM is suddently down no segfault nothing the kvm process just disappears...

Anybody any idea how to debug this?

Sadly i can't reproduce. Qemu version is 1.4.1.

1. Double-check dmesg(1) for out-of-memory killer or segfaults.

2. Check libvirt or other management tool logs again.

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

Stefan

#7 lore raw

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 9 lines · Stefan Priebe - Profihost AG
Quoted 6 lines

i've now seen this several times. A VM is suddently down no segfault nothing the kvm process just disappears...

Anybody any idea how to debug this?

Sadly i can't reproduce. Qemu version is 1.4.1.

1. Double-check dmesg(1) for out-of-memory killer or segfaults.

done => nothing in there also 120-140GB mem free.

Quoted 1 line

2. Check libvirt or other management tool logs again.

kvm process was started via bash no management tool involved.

Quoted 3 lines

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

LD_PRELOAD sounds good can you point me to such a lib?

Stefan

#8 lore raw
Quoted 7 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 4 lines · Stefan Priebe - Profihost AG

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

LD_PRELOAD sounds good can you point me to such a lib?

$ cat /tmp/catchexit.c
#include <unistd.h>
#include <stdlib.h>

void exit(int status)

{
    const char msg[] = "*** CAUGHT EXIT, DUMPING CORE ***\n";
    write(2, msg, sizeof msg);
    abort();
}

void _exit(int status) __attribute__((alias("exit")));

$ gcc -o catchexit.so -shared -fPIC -std=gnu99 catchexit.c
$ LD_PRELOAD=/tmp/catchexit.so x86_64-softmmu/qemu-system-x86_64 -m
1024 -enable-kvm -cpu host -vga asdf
Unknown vga type: asdf
*** CAUGHT EXIT, DUMPING CORE ***
Aborted (core dumped)

Make sure to give the absolute path to catchexit.so. Also keep in mind that this does not catch a normal return from main() or possibly other ways of terminating the process.

You can hook more library functions, if necessary.

Stefan

#9 lore raw

[Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Am 10.05.2013 13:09, schrieb Stefan Hajnoczi:

Quoted 7 lines
Quoted 5 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 4 lines · Stefan Priebe - Profihost AG

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

This time i had a segfault Qemu 1.4.1 plus
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=dc7588c1eb3008bda53dde1d6b890cd299758155.

aio_bh_poll async.c:80

Code...

   for (bh = ctx->first_bh; bh; bh = next) {
        next = bh->next;
        if (!bh->deleted && bh->scheduled) {
            bh->scheduled = 0;
            if (!bh->idle)
                ret = 1;
            bh->idle = 0;
            bh->cb(bh->opaque);
        }
    }
    ctx->walking_bh--;

    /* remove deleted bhs */
    if (!ctx->walking_bh) {
        bhp = &ctx->first_bh;
        while (*bhp) {
            bh = *bhp;
===== THIS IS THE SEGFAULT LINE =====            if (bh->deleted) {
                *bhp = bh->next;
                g_free(bh);
            } else {
                bhp = &bh->next;
            }
        }
    }

    return ret;

Greets,
Stefan

#10 lore raw

Re: [Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Quoted 36 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 13:09, schrieb Stefan Hajnoczi:

Quoted 7 lines
Quoted 5 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 4 lines · Stefan Priebe - Profihost AG

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

This time i had a segfault Qemu 1.4.1 plus
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=dc7588c1eb3008bda53dde1d6b890cd299758155.

aio_bh_poll async.c:80

Code...

   for (bh = ctx->first_bh; bh; bh = next) {
        next = bh->next;
        if (!bh->deleted && bh->scheduled) {
            bh->scheduled = 0;
            if (!bh->idle)
                ret = 1;
            bh->idle = 0;
            bh->cb(bh->opaque);
        }
    }
    ctx->walking_bh--;

    /* remove deleted bhs */
    if (!ctx->walking_bh) {
        bhp = &ctx->first_bh;
        while (*bhp) {
            bh = *bhp;
===== THIS IS THE SEGFAULT LINE =====            if (bh->deleted) {
                *bhp = bh->next;
Quoted 8 lines
                g_free(bh);
            } else {
                bhp = &bh->next;
            }
        }
    }

    return ret;

Interesting crash. Do you have the output of "thread apply all bt"?

I would try looking at the AioContext using "p *ctx", and print out the ctx->first_bh linked list.

Stefan

#11 lore raw

Re: [Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Am 14.05.2013 17:05, schrieb Stefan Hajnoczi:

Quoted 45 lines
Quoted 43 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 13:09, schrieb Stefan Hajnoczi:

Quoted 7 lines
Quoted 5 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 4 lines · Stefan Priebe - Profihost AG

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

This time i had a segfault Qemu 1.4.1 plus
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=dc7588c1eb3008bda53dde1d6b890cd299758155.

aio_bh_poll async.c:80

Code...

   for (bh = ctx->first_bh; bh; bh = next) {
        next = bh->next;
        if (!bh->deleted && bh->scheduled) {
            bh->scheduled = 0;
            if (!bh->idle)
                ret = 1;
            bh->idle = 0;
            bh->cb(bh->opaque);
        }
    }
    ctx->walking_bh--;

    /* remove deleted bhs */
    if (!ctx->walking_bh) {
        bhp = &ctx->first_bh;
        while (*bhp) {
            bh = *bhp;
===== THIS IS THE SEGFAULT LINE =====            if (bh->deleted) {
                *bhp = bh->next;
                g_free(bh);
            } else {
                bhp = &bh->next;
            }
        }
    }
Quoted 6 lines
Quoted 1 line
    return ret;

Interesting crash. Do you have the output of "thread apply all bt"?

I would try looking at the AioContext using "p *ctx", and print out the ctx->first_bh linked list.

Hi,

as i can't reproduce no ;-( i just saw the kernel segfault message and used addr2line and a qemu dbg package to get the code line.

Stefan

#12 lore raw

Re: [Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Hi josh, hi Stefan,

Quoted 50 lines

Am 14.05.2013 17:05, schrieb Stefan Hajnoczi:

Quoted 49 lines
Quoted 41 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 13:09, schrieb Stefan Hajnoczi:

Quoted 7 lines
Quoted 5 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 4 lines · Stefan Priebe - Profihost AG

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

This time i had a segfault Qemu 1.4.1 plus
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=dc7588c1eb3008bda53dde1d6b890cd299758155.

aio_bh_poll async.c:80

Code...

  for (bh = ctx->first_bh; bh; bh = next) {
       next = bh->next;
       if (!bh->deleted && bh->scheduled) {
           bh->scheduled = 0;
           if (!bh->idle)
               ret = 1;
           bh->idle = 0;
           bh->cb(bh->opaque);
       }
   }
   ctx->walking_bh--;

   /* remove deleted bhs */
   if (!ctx->walking_bh) {
       bhp = &ctx->first_bh;
       while (*bhp) {
           bh = *bhp;
===== THIS IS THE SEGFAULT LINE =====            if (bh->deleted) {
               *bhp = bh->next;
               g_free(bh);
           } else {
               bhp = &bh->next;
           }
       }
Quoted 3 lines

}

   return ret;

Interesting crash. Do you have the output of "thread apply all bt"?

Quoted 7 lines
Quoted 2 lines

I would try looking at the AioContext using "p *ctx", and print out the ctx->first_bh linked list.

Hi,

as i can't reproduce no ;-( i just saw the kernel segfault message and used addr2line and a qemu dbg package to get the code line.

I've now seen this again for two or three times. It always happens when we do an fstrim inside the guest.

And I've seen this first since josh async rbd patch.

Stefan

Quoted 2 lines

Stefan

#13 lore raw

Re: [Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Il 22/05/2013 08:26, Stefan Priebe - Profihost AG ha scritto:

Quoted 10 lines
Quoted 4 lines

Hi,

as i can't reproduce no ;-( i just saw the kernel segfault message and used addr2line and a qemu dbg package to get the code line.

I've now seen this again for two or three times. It always happens when we do an fstrim inside the guest.

And I've seen this first since josh async rbd patch.

This one?

commit dc7588c1eb3008bda53dde1d6b890cd299758155

Author: Josh Durgin <[email protected]>
Date:   Fri Mar 29 13:03:23 2013 -0700

rbd: add an asynchronous flush

The existing bdrv_co_flush_to_disk implementation uses rbd_flush(), which is sychronous and causes the main qemu thread to block until it is complete. This results in unresponsiveness and extra latency for the guest.

Fix this by using an asynchronous version of flush. This was added to librbd with a special #define to indicate its presence, since it will be backported to stable versions. Thus, there is no need to check the version of librbd.

Implement this as bdrv_aio_flush, since it matches other aio functions in the rbd block driver, and leave out bdrv_co_flush_to_disk when the asynchronous version is available.

Do you see it even with "-drive discard=off"?

Paolo

#14 lore raw

Re: [Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Am 22.05.2013 um 10:41 schrieb Paolo Bonzini <[email protected]>:

Quoted 10 lines

Il 22/05/2013 08:26, Stefan Priebe - Profihost AG ha scritto:

Quoted 7 lines
Quoted 4 lines

Hi,

as i can't reproduce no ;-( i just saw the kernel segfault message and used addr2line and a qemu dbg package to get the code line.

I've now seen this again for two or three times. It always happens when we do an fstrim inside the guest.

Quoted 5 lines
Quoted 1 line

And I've seen this first since josh async rbd patch.

This one?

commit dc7588c1eb3008bda53dde1d6b890cd299758155

Yes. But i'm not sure whether this is coincendence.

Quoted 3 lines

Do you see it even with "-drive discard=off"?

I use discard / trim for thin provisioning and need it. This is a production system so I can't test without it.

I use scsi virtio with discard_granularity=512

Stefan

Quoted 1 line

Paolo

#15 lore raw

Re: [Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Il 22/05/2013 14:24, Stefan Priebe - Profihost AG ha scritto:

Quoted 12 lines

Am 22.05.2013 um 10:41 schrieb Paolo Bonzini <[email protected]>:

Quoted 10 lines

Il 22/05/2013 08:26, Stefan Priebe - Profihost AG ha scritto:

Quoted 7 lines
Quoted 4 lines

Hi,

as i can't reproduce no ;-( i just saw the kernel segfault message and used addr2line and a qemu dbg package to get the code line.

I've now seen this again for two or three times. It always happens when we do an fstrim inside the guest.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

And I've seen this first since josh async rbd patch.

This one?

commit dc7588c1eb3008bda53dde1d6b890cd299758155

Yes. But i'm not sure whether this is coincendence.

Ok.

Quoted 6 lines
Quoted 1 line

Do you see it even with "-drive discard=off"?

I use discard / trim for thin provisioning and need it. This is a production system so I can't test without it.

I use scsi virtio with discard_granularity=512

Note that 1.5.0 won't need this anymore, but it will need "-drive discard=on". Any chance you can try to reproduce it in a different environment?

Paolo

#16 lore raw

Re: [Qemu-devel] segfault in aio_bh_poll async.c:80 WAS: Re: kvm process disappears

Am 23.05.2013 12:09, schrieb Paolo Bonzini:

Quoted 25 lines

Il 22/05/2013 14:24, Stefan Priebe - Profihost AG ha scritto:

Quoted 12 lines

Am 22.05.2013 um 10:41 schrieb Paolo Bonzini <[email protected]>:

Quoted 10 lines

Il 22/05/2013 08:26, Stefan Priebe - Profihost AG ha scritto:

Quoted 7 lines
Quoted 4 lines

Hi,

as i can't reproduce no ;-( i just saw the kernel segfault message and used addr2line and a qemu dbg package to get the code line.

I've now seen this again for two or three times. It always happens when we do an fstrim inside the guest.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

And I've seen this first since josh async rbd patch.

This one?

commit dc7588c1eb3008bda53dde1d6b890cd299758155

Yes. But i'm not sure whether this is coincendence.

Ok.

Quoted 2 lines
Quoted 1 line

Do you see it even with "-drive discard=off"?

Quoted 8 lines
Quoted 4 lines

I use discard / trim for thin provisioning and need it. This is a production system so I can't test without it.

I use scsi virtio with discard_granularity=512

Note that 1.5.0 won't need this anymore, but it will need "-drive discard=on". Any chance you can try to reproduce it in a different environment?

OK i'll try to update to 1.5.0.

Stefan

#17 lore raw
In reply to Stefan Hajnoczi

Am 10.05.2013 13:09, schrieb Stefan Hajnoczi:

Quoted 31 lines
Quoted 7 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 4 lines · Stefan Priebe - Profihost AG

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

LD_PRELOAD sounds good can you point me to such a lib?

$ cat /tmp/catchexit.c
#include <unistd.h>
#include <stdlib.h>

void exit(int status)

{
     const char msg[] = "*** CAUGHT EXIT, DUMPING CORE ***\n";
     write(2, msg, sizeof msg);
     abort();
}

void _exit(int status) __attribute__((alias("exit")));

$ gcc -o catchexit.so -shared -fPIC -std=gnu99 catchexit.c
$ LD_PRELOAD=/tmp/catchexit.so x86_64-softmmu/qemu-system-x86_64 -m
1024 -enable-kvm -cpu host -vga asdf
Unknown vga type: asdf
*** CAUGHT EXIT, DUMPING CORE ***
Aborted (core dumped)
Quoted 7 lines

Make sure to give the absolute path to catchexit.so. Also keep in mind that this does not catch a normal return from main() or possibly other ways of terminating the process.

You can hook more library functions, if necessary.

Stefan

I'm really sorry for bothering you. It turned out to be a host kernel bug. Without NUMA Balancing turned on (kernel 3.8.13) i see no vm crashes at all...

Greets,
Stefan

#18 lore raw
Quoted 36 lines · Stefan Priebe

Am 10.05.2013 13:09, schrieb Stefan Hajnoczi:

Quoted 35 lines
Quoted 7 lines · Stefan Priebe - Profihost AG

Am 10.05.2013 09:42, schrieb Stefan Hajnoczi:

Quoted 4 lines · Stefan Priebe - Profihost AG

3. Either use gdb or an LD_PRELOAD library that catches exit(3) and _exit(2) and dumps core using abort(3). Make sure core dumps are enabled.

LD_PRELOAD sounds good can you point me to such a lib?

$ cat /tmp/catchexit.c
#include <unistd.h>
#include <stdlib.h>

void exit(int status)

{
    const char msg[] = "*** CAUGHT EXIT, DUMPING CORE ***\n";
    write(2, msg, sizeof msg);
    abort();
}

void _exit(int status) __attribute__((alias("exit")));

$ gcc -o catchexit.so -shared -fPIC -std=gnu99 catchexit.c
$ LD_PRELOAD=/tmp/catchexit.so x86_64-softmmu/qemu-system-x86_64 -m
1024 -enable-kvm -cpu host -vga asdf
Unknown vga type: asdf
*** CAUGHT EXIT, DUMPING CORE ***
Aborted (core dumped)

Make sure to give the absolute path to catchexit.so. Also keep in mind that this does not catch a normal return from main() or possibly other ways of terminating the process.

Quoted 7 lines
Quoted 3 lines

You can hook more library functions, if necessary.

Stefan

I'm really sorry for bothering you. It turned out to be a host kernel bug. Without NUMA Balancing turned on (kernel 3.8.13) i see no vm crashes at all...

No worries. Glad you found the solution.

Stefan