From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: bug#28211: Grafting code triggers GC/thread-safety issue on Guile 2.2.2 Date: Thu, 10 May 2018 11:48:47 -0400 Message-ID: <878t8reckg.fsf@netris.org> References: <877exuj58y.fsf@gnu.org> <87d0yo1tie.fsf@gnu.org> <87fu3124nt.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGnpV-0004O8-93 for bug-guix@gnu.org; Thu, 10 May 2018 11:50:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGnpS-00076X-Im for bug-guix@gnu.org; Thu, 10 May 2018 11:50:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:48761) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGnpS-00076T-Fz for bug-guix@gnu.org; Thu, 10 May 2018 11:50:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87fu3124nt.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 08 May 2018 23:55:50 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Andy Wingo , 28211@debbugs.gnu.org Hi, I've been studying the backtrace provided by Ludovic, trying to determine where, in the Scheme code, this error happened in thread 1. ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Thread 1 (Thread 0x7f6fe6f5d700 (LWP 2856)): > #0 0x00007f7019db0d79 in scm_is_pair (x=3D0x0) at ../libguile/pairs.h:159 > #1 scm_ilength (sx=3D) at list.c:190 > #2 0x00007f7019e0e2f6 in vm_regular_engine (thread=3D0x1425670, vp=3D0x1= 44e6c0, registers=3D0x0, resume=3D16) at vm-engine.c:909 > #3 0x00007f7019e117da in scm_call_n (proc=3Dproc@entry=3D#, argv=3Dargv@entry=3D0x0, nargs=3Dnargs@entry=3D0) at vm.c:1257 > #4 0x00007f7019d94879 in scm_call_0 (proc=3Dproc@entry=3D#) at eval.c:481 > #5 0x00007f7019d85eb8 in scm_call_with_unblocked_asyncs (proc=3D#) at async.c:400 > #6 0x00007f7019e0e17d in vm_regular_engine (thread=3D0x1425670, vp=3D0x1= 44e6c0, registers=3D0x0, resume=3D16) at vm-engine.c:784 > #7 0x00007f7019e117da in scm_call_n (proc=3D#, argv=3Da= rgv@entry=3D0x0, nargs=3Dnargs@entry=3D0) at vm.c:1257 > #8 0x00007f7019d94879 in scm_call_0 (proc=3D) at eval.c:4= 81 > #9 0x00007f7019dff496 in really_launch (d=3D0x149e520) at threads.c:794 The call to 'scm_call_with_unblocked_asyncs' in frame #5 is an important clue, because it is used in very few places. I see only two such places in Guile (and none in Guix): https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/scm-style-r= epl.scm?h=3Dv2.2.3#n80 https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/threads.scm= ?h=3Dv2.2.3#n158 I assume that it must be the second one in this case. So, I believe frames 5-9 correspond to lines 147 through 158 of ice-9/threads.scm: https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/threads.scm= ?h=3Dv2.2.3#n147 which is within 'call-with-new-thread', called via the 'begin-thread' macro used by 'n-par-for-each', here: https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/threads.scm= ?h=3Dv2.2.3#n320 However, I would expect to see a 'catch' frame deeper in the stack, since the procedure passed to 'n-par-for-each' by graft.scm is wrapped by 'exit-on-exception'. >From these facts, I believe we can conclude that the error is happening within the body of 'begin-thread' in 'n-par-for-each', but outside of the body of 'proc' passed to 'n-par-for-each'. There's not a lot of code in there. My best guess at the moment is that this error is happening within the (apply proc args) on line 335, although I do not yet have an explanation of how that could happen. To be continued... Mark