Comment 101 for bug 522538

Revision history for this message
ooze (zoe-gauthier) wrote :

The content of desktop-couchdb.stderr.* when gwibber-service stops working properly:

heart_beat_kill_pid = 2954
heart_beat_timeout = 11
heart: Thu Jun 24 10:19:32 2010: Erlang has closed.^M
Segmentation fault
heart: Thu Jun 24 10:19:34 2010: Executed "/usr/bin/couchdb -k". Terminating.^M

Traceback from gwibber-service is:

  File "/usr/lib/python2.6/dist-packages/gwibber/microblog/dispatcher.py", line 540, in refresh
    operations = list(self.collector.get_operations())
  [...]
  File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 750, in connect
    raise socket.error, msg
socket.error: [Errno 111] Connexion refusée

If I relaunch gwibber, I get the following log message from gwibber-service. This comes from the patch of bug #539674 :

WARNING:root:DB connection timed out. Reconnecting.

My understanding so far:
  - couchdb/desktopcouch server crashes for some unknown reason.
  - gwibber-service tries to connect to desktopcouch.
    - This probably launches a new instance of couchdb/desktopcouch via DBus, but on a different port.
    - httplib2 fails to connect to the couchdb server because the couchdb client still holds the url of the crashed server.
    - The new httplib2 raises socket.error instead of AttributeError, so there is no reconnect.
  - gwibber is launched, which cause the same problem, but httplib2 raises AttributeError (?).
    - The gwibber service tries to reconnect, but it fails for the same reason.

I can improve things with the following (crude) code appended to desktopcouch/records/server.py, but gwibber will still crash by not handling exceptions in other cases :

    def get_records(self, record_type=None, create_view=False,
             design_doc=None):
        try:
            return super(CouchDatabase, self).get_records(record_type, create_view, design_doc)
        except:
            print "*** lp522538 ***"
            print "old uri: %s" % self.server_uri
            # Find the new port on which couchdb is listening.
            port = desktopcouch.find_port(ctx=self._server_class_extras["ctx"])
            self.server_uri = "http://localhost:%s" % port
            print "new uri: %s" % self.server_uri
            self._reconnect()
            return super(CouchDatabase, self).get_records(record_type, create_view, design_doc)