Mic92 / nixpkgs-review

Review pull-requests on https://github.com/NixOS/nixpkgs
MIT License
380 stars 63 forks source link

Posting result comment failed #277

Closed davidak closed 1 year ago

davidak commented 2 years ago

It always worked until today.

/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/bin/nixpkgs-review from stable channel NixOS 22.05.3389.9cac4585028

...
Posting result comment on https://github.com/NixOS/nixpkgs/pull/194119
$ git worktree prune
Traceback (most recent call last):
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/http/client.py", line 1447, in connect
    super().connect()
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/http/client.py", line 946, in connect
    self.sock = self._create_connection(
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/socket.py", line 823, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
OSError: [Errno 16] Device or resource busy

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/bin/.nixpkgs-review-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/lib/python3.9/site-packages/nixpkgs_review/__init__.py", line 10, in main
    cli.main(command, args)
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/lib/python3.9/site-packages/nixpkgs_review/cli/__init__.py", line 280, in main
    return cast(str, args.func(args))
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/lib/python3.9/site-packages/nixpkgs_review/cli/pr.py", line 76, in pr_command
    review.start_review(attrs, path, pr, args.post_result)
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/lib/python3.9/site-packages/nixpkgs_review/review.py", line 231, in start_review
    self.github_client.comment_issue(pr, report.markdown(pr))
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/lib/python3.9/site-packages/nixpkgs_review/github.py", line 44, in comment_issue
    return self.post(
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/lib/python3.9/site-packages/nixpkgs_review/github.py", line 36, in post
    return self._request(path, "POST", data)
  File "/nix/store/7jvbd44gb2s6jh8adp9r4wbx6pxvvxdw-nixpkgs-review-2.6.4/lib/python3.9/site-packages/nixpkgs_review/github.py", line 29, in _request
    resp = urllib.request.urlopen(req)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/nix/store/vl15w3q3ck77gk0yi03abi3xghxhlwgw-python3-3.9.13/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 16] Device or resource busy>

Maybe GitHub API was overloaded, my internet connection was interrupted or the token is wrong. In any case, it should give me a useful error message instead of this mess.

The change in the PR was one package removed:

1 package removed: Apple.Music (†1.5.5)

Nothing to be built.

Mic92 commented 1 year ago

Looks like a dns resolving error.

davidak commented 1 year ago

I had the issue again. Which is annoying, because i have to run it again and rebuild all failing packages.

I suggest to catch this error and show a user friendly error like "Error: Problems connecting to GitHub." and retry again 10 times. Like Nix, wait longer every time. You could have a loop that counts from 1 to 10 and add a 0 and wait that many seconds! That will help in case of any temporary network issues.

Mic92 commented 1 year ago

I don't think nixpkgs-review can or should fix your internet connection or github.