syncpackage: httplib2.error.ServerNotFoundError: Unable to find the server at api.launchpad.test

Bug #2024908 reported by Benjamin Drung
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Colin Watson

Bug Description

syncpackage fails to connect to api.launchpad.test:

```
Traceback:
 Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1343, in _conn_request
     conn.connect()
   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1119, in connect
     address_info = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 socket.gaierror: [Errno -2] Name or service not known

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/usr/bin/syncpackage", line 777, in <module>
     main()
   File "/usr/bin/syncpackage", line 658, in main
     Launchpad.login(**kwargs)
   File "/usr/lib/python3/dist-packages/ubuntutools/lp/lpapicache.py", line 84, in login
     self.__lp = LP.login_with("ubuntu-dev-tools", service, version=api_version)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 700, in login_with
     return cls._authorize_token_and_login(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 464, in _authorize_token_and_login
     return cls(
            ^^^^
   File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 230, in __init__
     super(Launchpad, self).__init__(
   File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 516, in __init__
     self._browser.get(root_resource), "application/json"
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 494, in get
     response, content = self._request(url, extra_headers=headers)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 441, in _request
     response, content = self._request_and_retry(
                         ^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 400, in _request_and_retry
     response, content = self._connection.request(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1701, in request
     (response, content) = self._request(
                           ^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 144, in _request
     response, content = super(LaunchpadOAuthAwareHttp, self)._request(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 204, in _request
     return super(RestfulHttp, self)._request(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1421, in _request
     (response, content) = self._conn_request(conn, request_uri, method, body, headers)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1350, in _conn_request
     raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
 httplib2.error.ServerNotFoundError: Unable to find the server at api.launchpad.test
```

syncpackage uses `Launchpad.login(service=args.lpinstance, api_version="devel")` (where args.lpinstance is `production`), but why does it use the devel API version?

ProblemType: Bug
DistroRelease: Ubuntu 23.04
Package: ubuntu-dev-tools 0.193ubuntu2
ProcVersionSignature: Ubuntu 6.2.0-20.20-generic 6.2.6
Uname: Linux 6.2.0-20-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.26.1-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: Unity:Unity7:ubuntu
Date: Fri Jun 23 16:44:20 2023
InstallationDate: Installed on 2022-03-20 (460 days ago)
InstallationMedia: Ubuntu 21.10 "Impish Indri" - Release amd64 (20211012)
PackageArchitecture: all
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: ubuntu-dev-tools
UpgradeStatus: Upgraded to lunar on 2023-04-20 (64 days ago)

Revision history for this message
Benjamin Drung (bdrung) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :

Looking at the Launchpad class, syncpackage should specify `service_root` instead of `service` (and `api_version` is renamed to `version`).

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-dev-tools (Ubuntu):
status: New → Confirmed
Revision history for this message
bastif (bastif) wrote :

Same error with backportpackage

Revision history for this message
bastif (bastif) wrote :

It worked until 2h ago, and now, not any more.

Revision history for this message
Benjamin Drung (bdrung) wrote :

My comment #2 is wrong. syncpackage uses lpapicache.py. So the parameters are okay.

Launchpad.__init__() from /usr/lib/python3/dist-packages/launchpadlib/launchpad.py is called with service_root="https://api.launchpad.net/"

Revision history for this message
Benjamin Drung (bdrung) wrote :

The reason is a malformed WADL file. That should be fixed by https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/445284

affects: ubuntu-dev-tools (Ubuntu) → launchpad
Changed in launchpad:
status: Confirmed → New
Bryce Harrington (bryce)
Changed in launchpad:
status: New → Confirmed
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

This has been fixed now.

Revision history for this message
Jürgen Gmach (jugmac00) wrote :
Changed in launchpad:
status: Confirmed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

Sorry for the inconvenience - this was due to some frontend reconfiguration work that went slightly wrong.

This is now fixed as well as we're able to, by reverting to the old frontend configuration for now, along with some work on the new `launchpad-assets` charm to stop this happening again once we switch back to it.

Unfortunately, some clients may have cached the old incorrect WADL file, and that was briefly served with an HTTP `Cache-Control` header that caused it to be considered fresh for 60 days. We don't have a way to recover from this automatically. If you still see the issue described in this bug, then you'll need to run `rm -rf ~/.launchpadlib/api.launchpad.net/cache/` and try again, as whichever user is running the program in question.

Changed in launchpad:
assignee: nobody → Colin Watson (cjwatson)
importance: Undecided → Critical
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.