desktopcouch applications throw 401 error

Bug #451809 reported by Rick Spencer
42
This bug affects 8 people
Affects Status Importance Assigned to Milestone
desktopcouch
Invalid
High
Chad Miller
desktopcouch (Ubuntu)
Invalid
High
Chad Miller

Bug Description

Binary package hint: desktopcouch

Tried two programs that are desktopcouch consumers, both of them failed to run and returned:

Traceback (most recent call last):
  File "bin/jotty", line 189, in <module>
    window = NewJottyWindow()
  File "bin/jotty", line 174, in NewJottyWindow
    window.finish_initializing(builder)
  File "bin/jotty", line 69, in finish_initializing
    self.database = CouchDatabase("jotty", create=True)
  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/server.py", line 54, in __init__
    server_class=server_class, oauth_tokens=oauth_tokens)
  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/server_base.py", line 122, in __init__
    if database not in self._server:
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 124, in __contains__
    self.resource.head(validate_dbname(name))
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 981, in head
    return self._request('HEAD', path, headers=headers, **params)
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 1035, in _request
    raise ServerError((status_code, error))
couchdb.client.ServerError: (401, '')

ProblemType: Bug
Architecture: i386
Date: Wed Oct 14 18:18:25 2009
DistroRelease: Ubuntu 9.10
Package: desktopcouch 0.4.4-0ubuntu1
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-14.46-generic
SourcePackage: desktopcouch
Uname: Linux 2.6.31-14-generic i686

Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

Note that this occurs on brand new code, essentially creating a new CouchDatabase like this:
self.__database = CouchDatabase(self.__db_name, create=True)

I also got the same error trying it directly in iPython:

In [3]: import desktopcouch.records

In [4]: desktopcouch.records.server.CouchDatabase("foob")
---------------------------------------------------------------------------
ServerError Traceback (most recent call last)

/home/rick/<ipython console> in <module>()

/usr/lib/python2.6/dist-packages/desktopcouch/records/server.pyc in __init__(self, database, uri, record_factory, create, server_class, oauth_tokens)
     50 port = desktopcouch.find_port()
     51 uri = "http://localhost:%s" % port
     52 super(CouchDatabase, self).__init__(
     53 database, uri, record_factory=record_factory, create=create,
---> 54 server_class=server_class, oauth_tokens=oauth_tokens)

/usr/lib/python2.6/dist-packages/desktopcouch/records/server_base.pyc in __init__(self, database, uri, record_factory, create, server_class, **server_class_extras)
    120 self.server_uri = uri
    121 self._server = server_class(self.server_uri, **server_class_extras)
--> 122 if database not in self._server:
    123 if create:
    124 self._server.create(database)

/usr/lib/pymodules/python2.6/couchdb/client.pyc in __contains__(self, name)
    122 """
    123 try:
--> 124 self.resource.head(validate_dbname(name))
    125 return True
    126 except ResourceNotFound:

/usr/lib/pymodules/python2.6/couchdb/client.pyc in head(self, path, headers, **params)
    979
    980 def head(self, path=None, headers=None, **params):
--> 981 return self._request('HEAD', path, headers=headers, **params)
    982
    983 def post(self, path=None, content=None, headers=None, **params):

/usr/lib/pymodules/python2.6/couchdb/client.pyc in _request(self, method, path, content, headers, **params)
   1033 raise PreconditionFailed(error)
   1034 else:
-> 1035 raise ServerError((status_code, error))
   1036
   1037 return resp, data

Changed in desktopcouch (Ubuntu):
importance: Undecided → High
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Tried with first install of Desktop couch, get NoSuchDatabase() exception

Revision history for this message
Ken VanDine (ken-vandine) wrote :

I can't confirm this, the same test worked for me with desktopcouch = 0.4.4-0ubuntu1

Revision history for this message
Ken VanDine (ken-vandine) wrote :

OK, after a reboot today I can reproduce this. My log files also have 401 errors for each attempt to access the url.

Revision history for this message
Chad Miller (cmiller) wrote :

I think the cause of this was fixed two weeks ago. I expect that the only people who will experience this problem are people who had v0.4.2 of desktopcouch installed and ran the desktopcouch-pair tool and changed the number of peer pairings.

That would read in the desktopcouch INI file, change the server bind-address, and write out the config file again. During that update, the Python ConfigParser class would crush keys to lowercase, including OAuth token values.

revno: 74 [merge]
revision-id: <email address hidden>
parent: <email address hidden>
parent: <email address hidden>
author: Chad Miller <email address hidden>
committer: Tarmac
branch nick: trunk
timestamp: Wed 2009-09-30 07:56:30 -0400
message:
  Do not let Python's ConfigParser transform options into lowercase, as
  couchdb options are case-sensitive.

The easy work-around for this bug is to remove the INI file and let it be created again when desktopcouch starts.

Without rebooting:
$ killall desktopcouch-service
$ /usr/lib/desktopcouch/desktopcouch-stop
$ mv ~/.config/desktop-couch/desktop-couchdb.ini{,-broken-by-lpbug451809 }

I'm going to close this bug, with the assumption that it happens only to a small fraction of beta users, and that that workaround fixes it. Please re-open it if there are any exceptions to those assumptions.

Changed in desktopcouch (Ubuntu):
status: New → Invalid
assignee: nobody → Chad Miller (cmiller)
Chad Miller (cmiller)
Changed in desktopcouch:
status: New → Won't Fix
assignee: nobody → Chad Miller (cmiller)
Changed in desktopcouch (Ubuntu):
status: Invalid → Confirmed
Changed in desktopcouch:
status: Won't Fix → Confirmed
importance: Undecided → High
Revision history for this message
Curtis Hovey (sinzui) wrote :

I was getting errors very similar to these. I discovered I had old launchpadlib and oath libs in /usr/local/lib/python2.6. Removing them allowed couch to start and now I can use gwibber and UbuntuOne

Chad Miller (cmiller)
Changed in desktopcouch:
status: Confirmed → Incomplete
Changed in desktopcouch (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Chad Miller (cmiller) wrote :

I don't think this is valid any more. Lucio, who re-opened this, plans to look for this again. Comment 6 has how to revert bad data in ones config.

Revision history for this message
Omer Akram (om26er) wrote :

there seems to be quite a few people facing this issue.

Revision history for this message
Omer Akram (om26er) wrote :

or not people actually get raise ServerError((status_code, error)) ServerError: (400, '')

Revision history for this message
Yura Tolstik (yltsrc) wrote :

I faced this issue with my program too.
Database created but server returns 400 error code.
To reproduce this issue you can delete database, which application used.

Traceback (most recent call last):
  File "./bin/engnotify", line 55, in <module>
    en = Engnotify()
  File "/home/yura/Projects/python/engnotify/engnotify/engnotify.py", line 40, in __init__
    self.database = CouchDatabase('engnotify', create=True)
  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/server.py", line 57, in __init__
    server_class=server_class, oauth_tokens=oauth_tokens, ctx=ctx)
  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/server_base.py", line 153, in __init__
    self._reconnect()
  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/server_base.py", line 183, in _reconnect
    if self._database_name not in self._server:
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 124, in __contains__
    self.resource.head(validate_dbname(name))
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 981, in head
    return self._request('HEAD', path, headers=headers, **params)
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 1035, in _request
    raise ServerError((status_code, error))
couchdb.client.ServerError: (400, '')

Revision history for this message
Yura Tolstik (yltsrc) wrote :

I catch this bug on ubuntu 10.10 with
desktopcouch:
  Installed: 0.6.6-0ubuntu3
  Candidate: 0.6.6-0ubuntu3
  Version table:
 *** 0.6.6-0ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ maverick/main i386 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Yura Tolstik (yltsrc) wrote :

but after
$ killall desktopcouch-service
$ /usr/lib/desktopcouch/desktopcouch-stop
$ mv ~/.config/desktop-couch/desktop-couchdb.ini{,-broken-by-lpbug451809 }
it works

Revision history for this message
Leo Arias (elopio) wrote :

Expiring incomplete bug after a lot of time of inactivity. Please reopen if still valid.

Changed in desktopcouch:
status: Incomplete → Invalid
Changed in desktopcouch (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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