unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 46967@debbugs.gnu.org
Subject: bug#46967: Connection reuse for substitutes breaks with gzip
Date: Tue, 09 Mar 2021 12:07:11 +0100	[thread overview]
Message-ID: <8735x4a8m8.fsf@gnu.org> (raw)
In-Reply-To: <878s70ibke.fsf@inria.fr> ("Ludovic Courtès"'s message of "Sat, 06 Mar 2021 15:47:13 +0100")

[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]

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

> As of commit cdc688c5ee106b7ee2547e4abd74ab81d7702d3d, it seems that the
> connection reuse code for substitutes breaks if you’re fetching gzip
> substitutes.

Here’s a simple reproducer that systematically fails after the first
download:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guile ~/src/guix-debugging/http-pipelining-gzip.scm

;;; (fetch 164664960)
Backtrace:
In ice-9/boot-9.scm:
  1736:10 11 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
          10 (apply-smob/0 #<thunk 7f9bf630c520>)
In ice-9/boot-9.scm:
    718:2  9 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8  8 (_ #(#(#<directory (guile-user) 7f9bf630fc80>)))
In ice-9/boot-9.scm:
   2806:4  7 (save-module-excursion _)
  4351:12  6 (_)
In /home/ludo/src/guix-debugging/http-pipelining-gzip.scm:
     18:4  5 (_)
In guix/http-client.scm:
   116:21  4 (http-fetch _ #:port _ #:text? _ #:buffered? _ #:open-connection _ #:keep-alive? _ # _ #:headers _ # _)
In web/client.scm:
   526:24  3 (http-request _ #:body _ #:verify-certificate? _ #:port _ #:method _ #:version _ #:keep-alive? _ # _ # …)
In web/response.scm:
   198:31  2 (read-response #<input-output: string 7f9bf36c6000>)
In web/http.scm:
  1194:12  1 (read-response-line _)
    252:2  0 (parse-http-version _ _ _)

web/http.scm:252:2: In procedure parse-http-version:
Bad http-version header component: \x1f\0\0\x03ì½

--8<---------------cut here---------------end--------------->8---

Ludo’.


[-- Attachment #2: the reproducer --]
[-- Type: text/plain, Size: 1160 bytes --]

(use-modules (guix http-client)
             ((guix build download) #:select (open-connection-for-uri))
             (guix utils)
             ((guix serialization) #:select (dump-port*))
             (web uri)
             (web request)
             (web response)
             (srfi srfi-1))

(define %base-url
  "https://ci.guix.gnu.org")

(define port
  (open-connection-for-uri (string->uri %base-url)))

(let loop ()
  (define-values (input size)
    (http-fetch (string->uri
                 "https://ci.guix.gnu.org/nar/gzip/0fcjk788gj7k6gsf3zsx8j8lyw6w896b-inkscape-1.0.2")
                #:port port
                #:text? #f
                #:open-connection open-connection-for-uri ;/cached
                #:keep-alive? #t
                #:buffered? #f))

  (define-values (decompressed pids)
    (decompressed-port 'gzip input))

  (setvbuf decompressed 'none)
  (call-with-output-file "/tmp/out"
    (lambda (output)
      (setvbuf output 'none)
      (dump-port* decompressed output
                  (pk 'fetch 164664960)))) ;size of compressed nar

  (unless (every (compose zero? cdr waitpid) pids)
    (error "decomp error"))

  (loop))

  reply	other threads:[~2021-03-09 11:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06 14:47 bug#46967: Connection reuse for substitutes breaks with gzip Ludovic Courtès
2021-03-09 11:07 ` Ludovic Courtès [this message]
2021-03-09 13:13   ` Ludovic Courtès
2021-03-11  8:26     ` Ludovic Courtès
2021-03-12 10:42       ` Ludovic Courtès
2021-03-12 15:08         ` Ludovic Courtès
2021-03-14 10:17           ` Ludovic Courtès
2021-03-16 18:34             ` Bonface Munyoki K.
2021-03-18  9:32               ` Ludovic Courtès
2021-03-10  1:28 ` Léo Le Bouter via Bug reports for GNU Guix

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=8735x4a8m8.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=46967@debbugs.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).