unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 48903@debbugs.gnu.org
Subject: bug#48903: guix substitute: error: TLS error in procedure 'read_from_session_record_port': Error decoding the received TLS packet.
Date: Wed, 30 Jun 2021 12:26:32 -0400	[thread overview]
Message-ID: <871r8j5nev.fsf@gmail.com> (raw)
In-Reply-To: <87sg10pdxs.fsf@gnu.org> ("Ludovic Courtès"'s message of "Tue, 29 Jun 2021 23:18:39 +0200")

Hello!

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> $ sudo ps -eF | grep guix-daemon
>> root 25193 216 0 3074 1524 3 Jun28 ?  00:00:00
>> /gnu/store/vphx2839xv0qj9xwcwrb95592lzrrnx7-guix-1.3.0-3.50dfbbf/bin/guix-daemon
>> 25178 guixbuild --max-silent-time 0 --timeout 0 --log-compression
>> none --discover=no --substitute-urls http://127.0.0.1:8080
>> https://ci.guix.gnu.org --max-jobs=4--8<---------------cut
>> here---------------end--------------->8---
>>
>> I can rather easily (and annoyingly!) trigger the problem (and a few
>> variations of it, it seems) with something like:
>>
>> $ packages=$(guix refresh -l protobuf | sed 's/^.*: //')
>> $ guix build -v3 --keep-going $packages
>>
>> For example, running the above, I just got:
>>
>> guix build: error: corrupt input while restoring archive from #<closed:
>> file 7fc95acfc2a0>
>> --8<---------------cut here---------------end--------------->8---
>>
>> Does the above commands succeed on the first time on your end?  If you
>> have already lots of things cached, you can try for an architecture you
>> don't often build for by adding the '--system=i686-linux' option; that
>> should cause a massive amount of downloads, likely to trigger the
>> problem.  Perhaps also try to use --max-jobs=4.
>
> I’ve tried that, with --max-jobs=4, and it fills my disk just fine.  :-/
>
>> If you have ideas of how to debug this when I hit the issue I'm all ears
>> :-).
>
> The attached patch substitutes a number of store items in a row; run:
>
>   guix repl -- substitute-stress.scm
>
> and it’ll fill /tmp/substitute-test with 200 substitutes, which should
> be equivalent to the kind of stress test you had above.
>
> It doesn’t crash for me.  There are a few “error: no valid substitute
> for /gnu/store/…” errors, but these are expected: was ask for
> substitutes for 200 packages without first checking whether substitutes
> are available.
>
> Could you run it and report back?
>
> You can try with more packages, different substitute URLs, etc.
>
> TIA!
>
> Ludo’.

[...]

I've tried with the following modified version which runs multiple
threads in parallel (to mimic --max-jobs=4 on the daemon), and I've yet
to trigger it, although the hard drive is grinding heavily:

--8<---------------cut here---------------start------------->8---
(use-modules (guix) (gnu packages)
             (guix scripts substitute)
             (guix grafts)
             (guix build utils)
             (srfi srfi-1)
             (ice-9 match)
             (ice-9 threads))

(define test-directory "/tmp/substitute-test")

(define max-jobs 4)

(define packages
  ;; Subset of packages for which we request substitutes.
  (append (map specification->package '("libreoffice"
                                        "ungoogled-chromium"
                                        "openjdk"
                                        "texmacs"))
          (take (fold-packages cons '()) 1000)))

(define (spawn-substitution-thread input urls)
  "Spawn a 'guix substitute' thread that reads commands from INPUT and uses
URLS as the substitute servers."
  (call-with-new-thread
   (lambda ()
     (parameterize ((%reply-file-descriptor #f)
                    (current-input-port input))
       (setenv "_NIX_OPTIONS"
               (string-append "substitute-urls=" (string-join urls)))
       (let loop ()
         (format (current-error-port) "starting substituter~%")
         ;; Catch "no valid substitute" errors.
         (catch 'quit
           (lambda ()
             (guix-substitute "--substitute"))
           (const #f))
         (unless (eof-object? (peek-char input))
           (loop)))))))

(for-each (lambda (job)
            (match (pipe)
              ((input . output)
               (let ((test-directory* (string-append test-directory "-"
                                                     (number->string job)))
                     (thread (spawn-substitution-thread
                              input %default-substitute-urls)))
                 ;; Remove the test directory.
                 (when (file-exists? test-directory*)
                   (for-each (lambda (f)
                               (false-if-exception (make-file-writable f)))
                             (find-files test-directory #:directories? #t))
                   (delete-file-recursively test-directory*))
                 (mkdir-p test-directory*)

                 (parameterize ((%graft? #false))
                   (with-store store
                     ;; Ask for substitutes for PACKAGES.
                     (for-each (lambda (package n)
                                 (define item
                                   (run-with-store store
                                     (package-file package)))

                                 (format output "substitute ~a ~a/~a~%"
                                         item test-directory* n))
                               packages
                               (iota (length packages))))
                   (format #t "sent ~a substitution requests...~%"
                           (length packages))
                   (close-port output)

                   ;; Wait for substitution to complete.
                   (join-thread thread))))))
          (iota max-jobs))
--8<---------------cut here---------------end--------------->8---

I wonder if there's something more happening in the real scenario
(validating signatures when putting things in the store? or something
similar) that may have a role in the failure.

That's a tough nut to crack!

I'll keep looking for clues.

Thanks for your time!

Maxim




  reply	other threads:[~2021-06-30 16:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 15:10 bug#48903: guix substitute: error: TLS error in procedure 'read_from_session_record_port': Error decoding the received TLS packet Maxim Cournoyer
2021-06-07 17:46 ` Maxime Devos
2021-06-11 15:09   ` Ludovic Courtès
2021-06-20 11:07     ` bug#49132: guix substitute: backtrace when the network is disabled during substitution Maxime Devos
2021-06-22 14:06       ` Ludovic Courtès
2023-06-08 21:17       ` Maxime Devos
2021-06-29 13:23     ` bug#48903: guix substitute: error: TLS error in procedure 'read_from_session_record_port': Error decoding the received TLS packet Maxim Cournoyer
2021-06-29 21:18       ` Ludovic Courtès
2021-06-30 16:26         ` Maxim Cournoyer [this message]
2021-07-01 13:12           ` Ludovic Courtès
2021-07-02 14:26             ` Maxim Cournoyer
2021-07-05 16:12               ` Ludovic Courtès
2021-07-08 13:59                 ` Maxim Cournoyer
2021-07-10 10:20                   ` Ludovic Courtès
2021-08-07  4:23                     ` Maxim Cournoyer

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=871r8j5nev.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=48903@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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).