/usr/share/oneconf/oneconf-service:httplib2.ServerNotFoundError:_conn_request:connect:connect:create_connection:getaddrinfo:process_sync:wrapper:list_machines:_get:_get:get:request_url:request:_request:_conn_request

Bug #1480491 reported by errors.ubuntu.com bug bridge
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oneconf (Ubuntu)
New
Undecided
Unassigned

Bug Description

The Ubuntu Error Tracker has been receiving reports about a problem regarding oneconf. This problem was most recently seen with version 0.3.8, the problem page at https://errors.ubuntu.com/problem/41aaab6ce7faa5a5dc15b54c76b0b8c7bc07bc24 contains more details.

Tags: trusty vivid wily
Revision history for this message
Brian Murray (brian-murray) wrote :

This seems to be a result of the change in bug 1165104. Its not clear to me whether or not the fix is exposing another problem or ended up creating one.

Revision history for this message
Brian Murray (brian-murray) wrote :

Bruno - since you worked on the fix for bug 1165104 - could you have a look at this issue?

Here's the traceback from the error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 965, in _conn_request
    conn.connect()
  File "/usr/lib/python3.4/http/client.py", line 1223, in connect
    super().connect()
  File "/usr/lib/python3.4/http/client.py", line 834, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python3.4/socket.py", line 494, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.4/socket.py", line 533, 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/lib/python3/dist-packages/oneconf/networksync/__init__.py", line 231, in process_sync
    full_hosts_list = self.infraclient.list_machines()
  File "/usr/lib/python3/dist-packages/piston_mini_client/validators.py", line 120, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/oneconf/networksync/infraclient_pristine.py", line 46, in list_machines
    return ast.literal_eval(self._get('list-machines/', scheme=AUTHENTICATED_API_SCHEME))
  File "/usr/lib/python3/dist-packages/oneconf/networksync/infraclient_pristine.py", line 35, in _get
    res = super()._get(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/piston_mini_client/__init__.py", line 787, in _get
    extra_headers=extra_headers)
  File "/usr/lib/python3/dist-packages/piston_mini_client/__init__.py", line 491, in get
    return self.request_url(url, method='GET', headers=headers)
  File "/usr/lib/python3/dist-packages/piston_mini_client/__init__.py", line 419, in request_url
    url, method=method, body=body, headers=headers)
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1291, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1041, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 972, in _conn_request
    raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.ServerNotFoundError: Unable to find the server at apps.ubuntu.com

Revision history for this message
Bruno Nova (brunonova) wrote :

I worked on the fix more than a year ago, so I don't remember much.

I don't see anything in the diff of my fix that has anything to do with connecting to servers.
Now, Iain Lane made an additional change to fix a hostname regex (http://bazaar.launchpad.net/~ubuntu-desktop/oneconf/trunk/revision/277), but that too probably isn't the cause of the bug.
Maybe it's another bug?

I have never received this error. Is this an error displayed by Apport?

Revision history for this message
Bruno Nova (brunonova) wrote :

I finally received an Apport error of oneconf, but it was another bug (Bug #1421884). Will comment on that one.

As for this bug, I think the code is missing some try...except blocks.
For example, in "/usr/lib/python3/dist-packages/oneconf/networksync/__init__.py", line 231 (mentioned in the traceback):
    full_hosts_list = self.infraclient.list_machines()
this will make a network connection. This is inside a try...except block, but it only checks for APIError. It should also check for network errors.

@Brian, the lack of those checks with try...except blocks is probably the bug here. Network errors can happen for various reasons.
I suggest adding an except block there (and in other places in that method) to check for network errors, and maybe also adding an extra catch-all except block to catch any other errors.
It would probably be better (and faster) for someone else, other than me, to do this.
What is your opinion?

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.