ocaml-opam / opam-publish

A tool to ease contributions to opam repositories
https://opam.ocaml.org
Other
40 stars 21 forks source link

`opam publish` fails with `"connect" failed: Connection timed out` #113

Closed zeptometer closed 3 years ago

zeptometer commented 3 years ago

When I ran opam publish --repo=na4zagin3/satyrographos-repo, I got the following error.

The following will be published:
  - satysfi-class-yabaitech version 0.0.6 with opam file at
    /home/zeptometer/code/yabaitech/satysfi-class-yabaitech/satysfi-class-yabaitech.opam
    archive at https://github.com/yabaitechtokyo/satysfi-class-yabaitech/archive/0.0.6.tar.gz
  - satysfi-class-yabaitech-doc version 0.0.6 with opam file at
    /home/zeptometer/code/yabaitech/satysfi-class-yabaitech/satysfi-class-yabaitech-doc.opam
    archive at https://github.com/yabaitechtokyo/satysfi-class-yabaitech/archive/0.0.6.tar.gz

Continue ? You will be shown the patch before submitting. [Y/n] y
[ERROR] Uncaught exception: /home/zeptometer/.opam/plugins/bin/opam-publish: "connect" failed: Connection timed out

opam publish (without --repo) gave the same error.

Here's my environment: ocaml: 4.11.1 opam: 2.0.5 opam-publish: 2.0.2 OS: Ubuntu 20.04 on WSL 2

AltGr commented 3 years ago

Thanks for the report! I failed to reproduce here on Linux... so this might be due to the way WSL2 handles networking? Another thing to check is the version of the github opam package, which has been updated a lot recently to match for Github API updates and deprecations.

zeptometer commented 3 years ago

Thank you for the quick response!

so this might be due to the way WSL2 handles networking?

Yes, that can be the case. The trouble is that I don't know where the failed connection aimed at... I cannot check if I can access it from my environment. I tried curl -i https://api.github.com/users/octocat/orgs, which returned 200. Would you mind providing what kind of network access might cause this connection timeout? (I'm not very familiar with OCaml and it'd be difficult to find it by myself, sorry)

Another thing to check is the version of the github opam package, which has been updated a lot recently to match for Github API updates and deprecations.

The version of github in my env is 4.3.2. Is it the right version?

AltGr commented 3 years ago

Try to run with GITHUB_DEBUG=1, it may give more information about the failed requests used for authentication and pull-request. We also run git commands like git fetch directly from opam-publish, but from your logs I think you didn't get to that stage. Add OPAMVERBOSE=2 to get debug info about those too.

zeptometer commented 3 years ago

After some investigation with the debug logs, I found that it's likely an issue with mirage/ocaml-cohttp where https connections result in timeout. I'll create an issue there and then close this issue. Thanks a lot for helping me find it out 🙏