From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: Hang in threads.test Date: Fri, 24 Sep 2010 11:33:05 +0200 Message-ID: <874odf8p0u.fsf@gnu.org> References: <87tylmrch6.fsf@ossau.uklinux.net> <87zkv94jf9.fsf@ossau.uklinux.net> <87y6asqe2i.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1285320913 23281 80.91.229.12 (24 Sep 2010 09:35:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2010 09:35:13 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Sep 24 11:35:10 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz4gN-0005f4-QF for guile-devel@m.gmane.org; Fri, 24 Sep 2010 11:35:08 +0200 Original-Received: from localhost ([127.0.0.1]:59970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz4gN-00032f-4A for guile-devel@m.gmane.org; Fri, 24 Sep 2010 05:35:07 -0400 Original-Received: from [140.186.70.92] (port=34271 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz4ei-0002Po-8K for guile-devel@gnu.org; Fri, 24 Sep 2010 05:33:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz4eg-0004Q1-Jq for guile-devel@gnu.org; Fri, 24 Sep 2010 05:33:24 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:45555) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz4eg-0004Pu-9X for guile-devel@gnu.org; Fri, 24 Sep 2010 05:33:22 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Oz4ed-00050o-Oj for guile-devel@gnu.org; Fri, 24 Sep 2010 11:33:19 +0200 Original-Received: from yoda.fdn.fr ([80.67.169.18]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Sep 2010 11:33:19 +0200 Original-Received: from ludo by yoda.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Sep 2010 11:33:19 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 96 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: yoda.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 3 =?iso-8859-1?Q?Vend=E9miaire?= an 219 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:gV8Rk9g6mfhku5AJlMyxn88VYSk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10949 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Neil, Neil Jerram writes: > Neil Jerram writes: > >> Neil Jerram writes: >> >>> My nightly build of master, on a relatively slow old machine, is >>> hanging, on most nights, in `make check'. >> >> FWIW, I realized that my backtraces are very similar to those reported >> by Dale here: >> http://www.mail-archive.com/bug-guile@gnu.org/msg05066.html. > > I think I have a reliable workaround for this, attached below. My > nightly build will now use this patch, and hopefully that'll mean that > it reliably produces benchmark data again. Great, thanks for tracking this down! > The hang seems to be caused by one thread (A) running (gc) at the same > time as another thread (B) is doing GC_malloc_atomic. The third thread > in the backtrace is the signal delivery thread, and not involved. [...] > My libgc is Debian version 1:7.1-3, so possibly this is a known libgc > issue that's already fixed upstream; I haven't tried to check that yet. The Debian patches at http://ftp.de.debian.org/debian/pool/main/libg/libgc/libgc_7.1-3.diff.gz look harmless. However, I cannot reproduce the problem with a stock 7.1 and a recent CVS libgc on x86_64-linux-gnu. Can you try running the attached program? It stays at 200% CPU on my dual-core machine (i.e., does not hang.) Thanks, Ludo’. --=-=-= Content-Type: text/x-csrc Content-Disposition: inline; filename=gc-race.c Content-Description: the file #define GC_THREADS 1 #define GC_REDIRECT_TO_LOCAL 1 #include #include #include void *a; static void * alloc_thread (void *data) { while (1) a = GC_MALLOC_ATOMIC (123); return NULL; } static void * gc_thread (void *data) { while (1) GC_gcollect (); return NULL; } int main (int argc, char *argv[]) { pthread_t alloc, gc; GC_INIT (); pthread_create (&alloc, NULL, alloc_thread, NULL); pthread_create (&gc, NULL, gc_thread, NULL); while (1); return EXIT_SUCCESS; } --=-=-=--