From: Stefan Hajnoczi <stefanha@gmail.com>
To: Mario DE CHENNO <MARIO.DECHENNO@unina2.it>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] R: qemu-nbd segmentation fault
Date: Thu, 19 Sep 2013 12:05:58 +0200 [thread overview]
Message-ID: <20130919100558.GD22814@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CA5738A48ECC364E99850D441F7893555F518C@MAILCHANGE.ceda.unina2.it>
On Wed, Sep 18, 2013 at 03:35:12PM +0200, Mario DE CHENNO wrote:
> This time crashed just issuing a mount command:
>
> Starting program: /vmstore/vmtools/qemu-nbd-from1.6.0 /vmstore/playground/archivioweb.img
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7ffff55e3700 (LWP 7626)]
> [New Thread 0x7ffff47dd700 (LWP 7645)]
> [New Thread 0x7ffff3fdc700 (LWP 7646)]
> [New Thread 0x7ffff37db700 (LWP 7647)]
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7ffff37db700 (LWP 7647)]
> 0x00007ffff7717249 in ?? () from /usr/lib64/libglib-2.0.so.0
> (gdb) bt
> #0 0x00007ffff7717249 in ?? () from /usr/lib64/libglib-2.0.so.0
> #1 0x00007ffff771759c in ?? () from /usr/lib64/libglib-2.0.so.0
> #2 0x00007ffff7718958 in g_slice_free1 () from /usr/lib64/libglib-2.0.so.0
> #3 0x0000555555591c2d in aio_worker (arg=0x555555c2f6c0) at block/raw-posix.c:776
> #4 0x00005555555da094 in worker_thread (opaque=0x555555c31a40) at thread-pool.c:109
> #5 0x00007ffff6c2ed6b in start_thread () from /lib64/libpthread.so.0
> #6 0x00007ffff6966abd in clone () from /lib64/libc.so.6
Please try this patch and let us know if it worked.
Older glib versions required the application to call g_thread_init().
Failure to do so results in the single-threaded code path being used.
In a multi-threaded application that means race conditions and I've seen
crashes similar to the backtrace you've posted.
diff --git a/qemu-nbd.c b/qemu-nbd.c
index c26c98e..8ae3868 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -357,6 +357,15 @@ int main(int argc, char **argv)
const char *fmt = NULL;
Error *local_err = NULL;
+ if (!g_thread_supported()) {
+#if !GLIB_CHECK_VERSION(2, 31, 0)
+ g_thread_init(NULL);
+#else
+ fprintf(stderr, "glib threading failed to initialize.\n");
+ exit(1);
+#endif
+ }
+
/* The client thread uses SIGTERM to interrupt the server. A signal
* handler ensures that "qemu-nbd -v -c" exits with a nice status code.
*/
next prev parent reply other threads:[~2013-09-19 10:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 12:53 [Qemu-devel] qemu-nbd segmentation fault ing. Mario De Chenno
2013-09-18 12:50 ` Stefan Hajnoczi
2013-09-18 13:35 ` [Qemu-devel] R: " Mario DE CHENNO
2013-09-19 10:05 ` Stefan Hajnoczi [this message]
2013-10-02 8:32 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130919100558.GD22814@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=MARIO.DECHENNO@unina2.it \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).