From: rixed@happyleptic.org
To: guile-user@gnu.org
Subject: Re: open-pipe deadlocked
Date: Fri, 2 Sep 2011 11:26:42 +0200 [thread overview]
Message-ID: <20110902092642.GB25610@ccellier.rd.securactive.lan> (raw)
In-Reply-To: <87d3fkc4xq.fsf@gnu.org>
> For 1.8, could you try running Helgrind and see what happens?
Helgrind complains about loads of 'possible data race' but does not
detect anything wrong when the actual deadlock occurs. When I exit
the program it does tell that a threads still own some lock, but
does not reveal the addresses of those in a meaningfull way for me:
==26762== Thread #1: Exiting thread still holds 1 lock
==26762== at 0x5A81B4D: waitpid (waitpid.c:41)
==26762== by 0x4F0A289: scm_waitpid (posix.c:560)
==27182== by 0x5A7BF09: pthread_mutex_lock (pthread_mutex_lock.c:61)
==26762== by 0x4E8FCBF: deval (eval.c:4229)
==27182== by 0x4C25BEF: pthread_mutex_lock (hg_intercepts.c:488)
==27182== by 0x4EF6606: scm_i_thread_put_to_sleep (threads.c:1676)
==26762== by 0x4E89B4F: scm_i_eval_x (eval.c:5900)
==27182== by 0x4E96D93: scm_i_gc (gc.c:550)
==27182== by 0x4E96CBC: scm_gc_for_newcell (gc.c:507)
==26762== by 0x4E8FCED: deval (eval.c:4232)
==27182== by 0x4EAC1B8: scm_cell (inline.h:122)
==26762== by 0x4E89C62: scm_i_eval (eval.c:5910)
==26762== by 0x4E710D7: scm_start_stack (debug.c:457)
==26762== by 0x4E71199: scm_m_start_stack (debug.c:473)
==26762==
==27182== by 0x4E91F5E: scm_dapply (eval.c:5012)
==27182==
(how pthread_mutex_lock apears to call scm_waitpid is not clear to me)
I don't know how helgrind works exactly, and thus can not be sure
its supposed to detect when a thread lock a mutex it already owns
(especially after a fork).
As to why it does not happen with guile2, this is still a mystery. My
theory about this deadlock is that the thread that calls open-process
owns the scm_i_port_table_mutex when open-process is called, and thus
the port-for-each call deadlock. But since
guile2's open-process does the same fork (not vfork), takes the same
scm_i_port_table_mutex in port-for-each, which mutex is still not
recursive, and yet does not deadlock, then maybe my theory is wrong in
the first place - or maybe the path that calls open-process while
scm_i_port_table_mutex is locked disapeared in guile2, maybe due to the
change of garbage collector (since the GC also grab this lock I
believe). Or maybe the deadlock involves another lock in addition to
this one. I'm going to turn scm_i_port_table_mutex into a recursive
mutex in order to try to invalidate my theory. sorry I'm thinking aloud
but maybe this can give you some better idea?
next prev parent reply other threads:[~2011-09-02 9:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 13:56 open-pipe deadlocked rixed
2011-08-02 21:24 ` Andreas Rottmann
2011-08-04 7:18 ` rixed
2011-09-01 21:45 ` Ludovic Courtès
2011-09-02 8:13 ` rixed
2011-09-02 9:26 ` rixed [this message]
2011-09-02 10:58 ` rixed
2011-09-02 10:58 ` rixed
2011-09-03 20:32 ` Ludovic Courtès
2011-09-04 10:18 ` Andy Wingo
2011-09-05 7:30 ` rixed
2011-08-10 18:31 ` rixed
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110902092642.GB25610@ccellier.rd.securactive.lan \
--to=rixed@happyleptic.org \
--cc=guile-user@gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).