Hi, Andy Wingo <wi...@igalia.com> skribis:
> On Fri 22 Sep 2017 16:10, l...@gnu.org (Ludovic Courtès) writes: > >> Hi Ricardo, >> >> Ricardo Wurmus <rek...@elephly.net> skribis: >> >>> The following derivation will be built: >>> /gnu/store/yvyfkns3w3vm7ynwbr7mvxcmin4gd2a0-guix-latest.drv >>> copying and compiling to >>> '/gnu/store/7m52dkr98nhwgpsx20mmpwyw2yzj58d3-guix-latest' with Guile >>> 2.2.2... >>> loading... 25.4% of 629 filesrandom seed for tests: 1506066913 >>> loading... 99.8% of 629 files >>> compiling... 69.2% of 629 filesice-9/threads.scm:289:22: In procedure >>> loop: >>> ice-9/threads.scm:289:22: Syntax error: >>> guix/scripts.scm:130:2: >>=: >>= (bind) used outside of 'with-monad' in >>> form (>>= (apply set-build-options* #:use-substitutes >>> ptions)) (lambda (unused-value) (mbegin %store-monad (mlet %store-monad >>> ((derivation (origin->derivation (package-source pack >>> tutes? use-substitutes? #:dry-run? dry-run?) (return >>> (show-derivation-outputs derivation))))))) >> >> This was reported at <https://bugs.gnu.org/27476>, and I suspect a >> thread-safety issue. However, syntax parameters are purely functional >> AFAICS, so I fail to see why multithreading could be a problem. >> >> Andy, any idea what could be causing this? > > I have heard of but not seen a number of similar bugs: errors that > "can't happen" but which appear under multiple threads. I don't know > what underlying pattern is. Has anyone found a test case that reliably > reproduces? With this program: --8<---------------cut here---------------start------------->8--- (use-modules (ice-9 threads) (srfi srfi-1)) (define-syntax-parameter foo (identifier-syntax +)) (define threads (unfold (lambda (x) (> x 100)) (lambda (x) (call-with-new-thread (lambda () (while #t (macroexpand '(syntax-parameterize ((foo (identifier-syntax -))) (foo y z))))))) 1+ 0)) (for-each join-thread threads) --8<---------------cut here---------------end--------------->8--- I managed to get a segfault: --8<---------------cut here---------------start------------->8--- $ guile syntax-parms.scm ;;; note: source file /home/ludo/src/guix/syntax-parms.scm ;;; newer than compiled /home/ludo/.cache/guile/ccache/2.2-LE-8-3.A/home/ludo/src/guix/syntax-parms.scm.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/ludo/src/guix/syntax-parms.scm ;;; compiled /home/ludo/.cache/guile/ccache/2.2-LE-8-3.A/home/ludo/src/guix/syntax-parms.scm.go In /home/ludo/src/guix/syntax-parms.scm: 13:17 13 (_) In ice-9/psyntax.scm: 1233:22 12 (expand-top-sequence (#(ribcage #(x) #((m-1dff1b83541ce327-7f97c #)) #) # …) …) In ice-9/boot-9.scm: 230:17 11 (map1 (#<tree-il (lambda-case (((id) #f #f #f () (id-1dff1b83541ce327-7fb4…>)) In ice-9/psyntax.scm: 2053:19 10 (_ _ #() (foo y z) ()) In ice-9/boot-9.scm: 230:17 9 (map1 #()) In ice-9/psyntax.scm: 1408:12 8 (_ _) 1788:11 7 (lp (1) (11 0 . 0)) 1678:45 6 (parse _ _ _ _ _ _ _) In ice-9/boot-9.scm: 230:17 5 (map1 ((tmp-1dff1b83541ce327-7f98b 0 . 0))) In ice-9/psyntax.scm: 2701:67 4 Adres-eraro --8<---------------cut here---------------end--------------->8--- … but then I failed to reproduce it again (that was on my 4-thread laptop). Ludo’.