Subject: Re: bug#62334: Network is unreachable only for recursive pypi import

From: Simon Tournier <[email-masked]>
Date: Tue, 25 Apr 2023 14:23:11 +0200

Hi,

On Tue, 21 Mar 2023 at 10:17, Greg Hogan <[email-masked]> wrote:

> --8<---------------cut here---------------start------------->8---
> $ guix describe
> Generation 38 Mar 21 2023 13:38:52 (current)
>   guix 38b64d4
>     repository URL: https://git.savannah.gnu.org/git/guix.git
>     branch: master
>     commit: 38b64d47ed3dfaeb63b859e7a8834e477ffed3a1
> --8<---------------cut here---------------end--------------->8---

I can reproduce.

> --8<---------------cut here---------------start------------->8---
> $ guix import pypi -r cdlib

[...]

> Starting download of /tmp/guix-file.xReGb4
> From https://files.pythonhosted.org/packages/49/01/21337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa/demon-2.0.6.tar.gz...
> In procedure connect: Network is unreachable
>
> Starting download of /tmp/guix-file.xReGb4
> From https://web.archive.org/web/20230321140958/https://files.pythonhosted.org/packages/49/01/21337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa/demon-2.0.6.tar.gz...
> In procedure connect*: Connection timed out

[...]

>    586:17  2 (map1 (("demon" #f) ("nf1" #f) ("eva-lcd" #f) ("b…" …) …))
> In guix/import/utils.scm:
>    630:33  1 (lookup-node "demon" #f)
> In ice-9/boot-9.scm:
>   1685:16  0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> Wrong number of values returned to continuation (expected 2)
> --8<---------------cut here---------------end--------------->8---

Well, tracking the origin of the failure “In procedure connect*:
Connection timed out”, it comes from ’open-socket-for-uri’, see (guix
build download).

Using the diff below, for some mysterious reasons, ’connect*’ throws the
error:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix import pypi -r cdlib
[...]
Starting download of /tmp/guix-file.Ujg3KY
>From https://files.pythonhosted.org/packages/49/01/21337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa/demon-2.0.6.tar.gz...

;;; (uri "https://files.pythonhosted.org/packages/49/01/21337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa/demon-2.0.6.tar.gz")

;;; (before #<input-output: socket 14> #(2 2454407487 443) 10)

;;; (failed #<input-output: socket 14>)

;;; (closed)

;;; (uri "https://files.pythonhosted.org/packages/49/01/21337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa/demon-2.0.6.tar.gz")

;;; (before #<input-output: socket 14> #(10 55849932267565577100763269369304187673 443 0 0) 10)

;;; (failed #<input-output: socket 14>)

;;; (closed)

;;; (boum)
In procedure connect: Network is unreachable
--8<---------------cut here---------------end--------------->8---

and note it is an issue on our side:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix import pypi -r demon
;;; (uri "https://pypi.org/pypi/demon/json")

;;; (before #<input-output: socket 13> #(2 2539978975 443) #f)

;;; (connect* #t)

;;; (done)

Starting download of /tmp/guix-file.G5r627
>From https://files.pythonhosted.org/packages/49/01/21337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa/demon-2.0.6.tar.gz...

;;; (uri "https://files.pythonhosted.org/packages/49/01/21337857631a97ab551bb2e3b5691ed6b1b9586011aa6a5355b9694a37fa/demon-2.0.6.tar.gz")

;;; (before #<input-output: socket 14> #(2 2454407487 443) 10)

;;; (connect* #<unspecified>)

;;; (done)
 ….6.tar.gz  7KiB                     4.2MiB/s 00:00 ▕██████████████████▏ 100.0%

Starting download of /tmp/guix-file.4L0Phu
>From https://files.pythonhosted.org/packages/96/85/5f9146e3f8d7324d8741cd3bea9b99926d5ee75571b9610c661b1bbd06f5/demon-2.0.6-py3-none-any.whl...

;;; (uri "https://files.pythonhosted.org/packages/96/85/5f9146e3f8d7324d8741cd3bea9b99926d5ee75571b9610c661b1bbd06f5/demon-2.0.6-py3-none-any.whl")

;;; (before #<input-output: socket 15> #(2 2454407487 443) 10)

;;; (connect* #<unspecified>)

;;; (done)
 …3-none-any.whl  7KiB                5.5MiB/s 00:00 ▕██████████████████▏ 100.0%
(define-public python-demon
  (package
    (name "python-demon")
    (version "2.0.6")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "demon" version))
              (sha256
               (base32
                "0nd370yjfb3jirmxd0wa03c75dl7jac4xfsq1rvp5483mxddirb0"))))
    (build-system python-build-system)
    (propagated-inputs (list python-networkx python-tqdm))
    (home-page "https://github.com/GiulioRossetti/DEMON")
    (synopsis "Community Discovery algorithm")
    (description "Community Discovery algorithm")
    (license license:bsd-2)))
--8<---------------cut here---------------end--------------->8---

Maybe, it is a regression from some recent updates of Guile?

I do not know…  Any idea?

Cheers,
simon