unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Andy Wingo <wingo@igalia.com>, 28211@debbugs.gnu.org
Subject: bug#28211: Grafting code triggers GC/thread-safety issue on Guile 2.2.2
Date: Thu, 10 May 2018 11:48:47 -0400	[thread overview]
Message-ID: <878t8reckg.fsf@netris.org> (raw)
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")

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ès) writes:
> Thread 1 (Thread 0x7f6fe6f5d700 (LWP 2856)):
> #0  0x00007f7019db0d79 in scm_is_pair (x=<error reading variable: ERROR: Cannot access memory at address 0x0>0x0) at ../libguile/pairs.h:159
> #1  scm_ilength (sx=<optimized out>) at list.c:190
> #2  0x00007f7019e0e2f6 in vm_regular_engine (thread=0x1425670, vp=0x144e6c0, registers=0x0, resume=16) at vm-engine.c:909
> #3  0x00007f7019e117da in scm_call_n (proc=proc@entry=#<program 1555fe0>, argv=argv@entry=0x0, nargs=nargs@entry=0) at vm.c:1257
> #4  0x00007f7019d94879 in scm_call_0 (proc=proc@entry=#<program 1555fe0>) at eval.c:481
> #5  0x00007f7019d85eb8 in scm_call_with_unblocked_asyncs (proc=#<program 1555fe0>) at async.c:400
> #6  0x00007f7019e0e17d in vm_regular_engine (thread=0x1425670, vp=0x144e6c0, registers=0x0, resume=16) at vm-engine.c:784
> #7  0x00007f7019e117da in scm_call_n (proc=#<program 13717c0>, argv=argv@entry=0x0, nargs=nargs@entry=0) at vm.c:1257
> #8  0x00007f7019d94879 in scm_call_0 (proc=<optimized out>) at eval.c:481
> #9  0x00007f7019dff496 in really_launch (d=0x149e520) 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-repl.scm?h=v2.2.3#n80
  https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/threads.scm?h=v2.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=v2.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=v2.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

  parent reply	other threads:[~2018-05-10 15:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 22:20 bug#28211: Grafting code triggers GC/thread-safety issue on Guile 2.2.2 Ludovic Courtès
2017-08-23 22:48 ` Ludovic Courtès
2018-04-24 16:03 ` Ludovic Courtès
2018-05-08 21:55   ` Ludovic Courtès
2018-05-09  0:32     ` Mark H Weaver
2018-05-09  7:17       ` Ludovic Courtès
2018-05-09  9:11       ` Andy Wingo
2018-05-10  6:50         ` Mark H Weaver
2018-05-10  7:53           ` Andy Wingo
2018-06-29 15:03             ` bug#28211: Stack marking issue in multi-threaded code Ludovic Courtès
2018-06-29 16:54               ` Mark H Weaver
2018-06-29 21:18                 ` Ludovic Courtès
2018-06-29 23:18                   ` Mark H Weaver
2018-06-30 20:53                     ` Ludovic Courtès
2018-06-30 21:49                       ` Mark H Weaver
2018-07-01 10:12                         ` Andy Wingo
2018-07-03 19:01                           ` Mark H Weaver
2020-03-12 21:59               ` bug#28211: Stack marking issue in multi-threaded code, 2020 edition Ludovic Courtès
2020-03-13 22:38                 ` Ludovic Courtès
2020-03-17 21:16                 ` Andy Wingo
2018-05-10 15:48     ` Mark H Weaver [this message]
2018-05-10 16:01       ` bug#28211: Grafting code triggers GC/thread-safety issue on Guile 2.2.2 Mark H Weaver
2018-07-02 10:28 ` Ludovic Courtès

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://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878t8reckg.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=28211@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=wingo@igalia.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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