Subject: bug#14404: regexp_exec thread-unsafe

From: [email-masked] (Ludovic Courtès)
Date: Wed, 15 May 2013 09:34:03 +0200

And here’s a reduced test case that “works” quite well on Guile 2.0.9:

--8<---------------cut here---------------start------------->8---
(use-modules (ice-9 threads)
             (ice-9 regex)
             (web uri)
             (srfi srfi-1)
             (srfi srfi-26))

(let ((do-regexps (lambda ()
                    (define seed1 (random 100000))
                    (define seed2 (random 100000))
                    (let loop ()
                      (let ((p (make-regexp "^http://([^/]+)/(.*)$"))
                            (s (string-append
                                "http://" (number->string seed1)
                                "hydra.gnu.org/nar/0did57blsaaspj49cl3q8nnydm5pr1qg-cflow-1.4"
                                (number->string seed2))))
                        (or (uri? (string->uri s))
                            (exit 42))
                        (regexp-exec p s)
                        (loop))))))
  (unfold (cute >= <> (current-processor-count))
          (lambda (i)
            (call-with-new-thread do-regexps))
          1+
          0)
  (do-regexps))
--8<---------------cut here---------------end--------------->8---

Ludo’.