caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Anyone else seeing core dumps in caml_thread_reinitialize?
@ 2012-07-16 12:23 Richard W.M. Jones
  2012-07-16 13:16 ` Richard W.M. Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Richard W.M. Jones @ 2012-07-16 12:23 UTC (permalink / raw)
  To: caml-list


I'm certainly not ruling out a bug in either libguestfs or our OCaml
4.00.0 +beta2 package, but has anyone who writes highly intensive
multithreaded programs which also fork seen segfaults in
caml_thread_reinitialize just after the fork?

The actual code being hit is:

  static void caml_thread_reinitialize(void)
  {
    caml_thread_t thr, next;
    struct channel * chan;

    /* Remove all other threads (now nonexistent)
       from the doubly-linked list of threads */
    thr = curr_thread->next;
    while (thr != curr_thread) {
      next = thr->next;            <---
      stat_free(thr);
      thr = next;
    }

and here is the stack trace:

#0  0x00000000004abcc8 in caml_thread_reinitialize ()
#1  0x0000003fc26bab9e in __libc_fork ()
    at ../nptl/sysdeps/unix/sysv/linux/fork.c:188
#2  0x0000003fc266cf34 in _IO_new_proc_open (fp=fp@entry=0x7f7868000f30, 
    command=command@entry=0x7f787a7fa2c0 "LC_ALL=C '/bin/qemu-kvm' -nographic -version 2>/dev/null", mode=<optimized out>, mode@entry=0x7f7881ecd090 "r")
    at iopopen.c:187
#3  0x0000003fc266d1c7 in _IO_new_popen (
    command=0x7f787a7fa2c0 "LC_ALL=C '/bin/qemu-kvm' -nographic -version 2>/dev/null", mode=0x7f7881ecd090 "r") at iopopen.c:308
#4  0x00007f7881eab88d in test_qemu_cmd (g=g@entry=0x7f78680008c0, 
    cmd=cmd@entry=0x7f787a7fa2c0 "LC_ALL=C '/bin/qemu-kvm' -nographic -version 2>/dev/null", ret=ret@entry=0x7f7868000910) at launch.c:1428
#5  0x00007f7881eaba04 in test_qemu (g=0x7f78680008c0) at launch.c:1410
#6  0x00007f7881eabaea in qemu_supports (g=g@entry=0x7f78680008c0, 
    option=option@entry=0x0) at launch.c:1479
#7  0x00007f7881eac921 in launch_appliance (g=g@entry=0x7f78680008c0)
    at launch.c:586
#8  0x00007f7881ead991 in guestfs__launch (g=g@entry=0x7f78680008c0)
    at launch.c:530
#9  0x00007f7881e4fda8 in guestfs_launch (g=g@entry=0x7f78680008c0)
    at actions.c:1119
#10 0x0000000000496ad8 in ocaml_guestfs_launch (gv=578721382704613384)
    at guestfs_c_actions.c:7544
#11 0x00000000004c3f9a in caml_c_call ()
#12 0x0000000000000001 in ?? ()

Unfortunately I have not been able to reproduce this bug in anything
smaller than my very large test case, which is why I'm asking if
anyone else has seen anything like this before.

  https://bugzilla.redhat.com/show_bug.cgi?id=838081

Rich.

-- 
Richard Jones
Red Hat

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Anyone else seeing core dumps in caml_thread_reinitialize?
  2012-07-16 12:23 [Caml-list] Anyone else seeing core dumps in caml_thread_reinitialize? Richard W.M. Jones
@ 2012-07-16 13:16 ` Richard W.M. Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Richard W.M. Jones @ 2012-07-16 13:16 UTC (permalink / raw)
  To: caml-list

On Mon, Jul 16, 2012 at 01:23:27PM +0100, Richard W.M. Jones wrote:
>   static void caml_thread_reinitialize(void)

Supplemental questions ..

What exactly is this function for?  I've seen the explanation in
PR#4577 but I'm still not exactly sure I understand why this function
is needed, particularly since when it fails we're just about to
exec(2) an entirely new process.

Also, in the cases where it's failing we've released the GC lock
(ie. we've called caml_enter_blocking_section).  Is this correct?
It appears that the GC could be in any intermediate state when
caml_thread_reinitialize is called.

Rich.

-- 
Richard Jones
Red Hat

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-16 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16 12:23 [Caml-list] Anyone else seeing core dumps in caml_thread_reinitialize? Richard W.M. Jones
2012-07-16 13:16 ` Richard W.M. Jones

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).