Subject: Re: bug#31925: 'guix substitutes' sometimes hangs on glibc 2.27

From: [email-masked] (Ludovic Courtès)
Date: Wed, 04 Jul 2018 09:03:53 +0200

[email-masked] (Ludovic Courtès) skribis:

> #0  0x00007fbb34bf794d in __GI___pthread_timedjoin_ex (threadid=140441961314048, thread_return=thread_return@entry=0x0, abstime=abstime@entry=0x0, block=block@entry=true)
>     at pthread_join_common.c:89
> #1  0x00007fbb34bf773c in __pthread_join (threadid=<optimized out>, thread_return=thread_return@entry=0x0) at pthread_join.c:24
> #2  0x00007fbb350d7548 in stop_finalization_thread () at finalizers.c:265
> #3  0x00007fbb350d7759 in scm_i_finalizer_pre_fork () at finalizers.c:290
> #4  0x00007fbb3514f256 in scm_fork () at posix.c:1222

Here’s a reproducer that works quite well (it hangs within a couple of
minutes):

(use-modules (guix utils)
             (ice-9 ftw)
             (ice-9 match)
             (srfi srfi-1)
             (srfi srfi-26)
             (rnrs io ports))

(define infodir
  (string-append (getenv "HOME")
                 "/.guix-profile/share/info/"))

(define files
  (apply circular-list
         (map (cut string-append infodir <>)
              (scandir infodir (lambda (file)
                                 (string-suffix? ".gz" file))))))

(sigaction SIGALRM
  (lambda _
    (alarm 1)))
(alarm 1)

(let loop ((files files)
           (n 0))
  (match files
    ((file . tail)
     (call-with-input-file file
       (lambda (port)
         (call-with-decompressed-port 'gzip port
           (lambda (port)
             (let loop ()
               (unless (eof-object? (get-bytevector-n port 777))
                 (loop)))))))
     ;; (pk 'loop n file)
     (display ".")
     (loop tail (+ n 1)))))

Ludo’.