add-apt-repository has a misleading error message when the launchpad api is down

Bug #2024926 reported by Stephane
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
New
Undecided
Unassigned

Bug Description

On Ubuntu 22.04.2
Package software-properties-common 0.99.22.7
During the launchpad outage on the 23rd June 2023, add-apt-repository was crashing with the following:
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 364, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
  File "/usr/bin/add-apt-repository", line 347, in main
    shortcut = handler(source, **shortcut_params)
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
    return handler(shortcut, **kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 82, in __init__
    if self.lpppa.publish_debug_symbols:
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 120, in lpppa
    self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 107, in lpteam
    self._lpteam = self.lp.people(self.teamname)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 98, in lp
    self._lp = login_func("%s.%s" % (self.__module__, self.__class__.__name__),
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 494, in login_anonymously
    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 477, in __init__
    self._browser.get(root_resource), 'application/json')
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 439, in get
    response, content = self._request(url, extra_headers=headers)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 389, in _request
    response, content = self._request_and_retry(
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 359, in _request_and_retry
    response, content = self._connection.request(
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1725, 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 184, in _request
    return super(RestfulHttp, self)._request(
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1441, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1363, in _conn_request
    conn.connect()
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1139, in connect
    address_info = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
  File "/usr/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
OSError: [Errno 16] Device or resource busy

This was misleading as it seemed to indicate a problem with the client and not with the server. The error message should be improved as to make it clear where the error is located.

Revision history for this message
Colin Watson (cjwatson) wrote (last edit ):

Note that this was due to a very specialized kind of outage, namely where the machine-readable API description file fetched from api.launchpad.net refers to api.launchpad.test (which only exists in some development setups and shouldn't be referred to from production). This part of the problem was on us (the Launchpad team), and we've fixed it.

It's also a little surprising, since we had other reports of clients (including at least one that was also running Ubuntu 22.04) instead raising the rather clearer `httplib2.error.ServerNotFoundError: Unable to find the server at api.launchpad.test` (still a bit confusing of course, but it points to the problem about as well as it can). I don't know why `socket.getaddrinfo` would raise `EBUSY` in this case, though.

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.