Notes API causes ResourceConflict

Bug #499595 reported by Chad Miller
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu One Servers
Fix Released
High
Chad Miller

Bug Description

Traceback (most recent call last):
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/couchdb/client.py, line 910, in _request
    raise ResourceConflict(error)
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/couchdb/client.py, line 867, in put
    **params)
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/couchdb/client.py, line 302, in __setitem__
    resp, data = self.resource.put(id, content=content)
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/ubuntuone/cloud_server/server.py, line 347, in put_record
    self.db[record_id] = record_data
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/ubuntuone/cloud_server/logger.py, line 31, in wrapper
    res = func(*args, **kwargs)
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/ubuntuone/web/notes/views.py, line 137, in edit_note
    Record(data=doc, record_type=NOTE_RECORD_TYPE))
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/ubuntuone/account/djangolib/decorators.py, line 30, in wrapper
    return func(request, *args, **kwargs)
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/django/contrib/auth/decorators.py, line 67, in __call__
    return self.view_func(request, *args, **kwargs)
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/django/core/handlers/base.py, line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  Module /srv/ubuntuone.com/production/ubunet-rev-2094/utilities/../lib/django/core/handlers/wsgi.py, line 239, in __call__
    response = self.get_response(request)
  Module /var/lib/python-support/python2.5/paste/translogger.py, line 67, in __call__
    return self.application(environ, replacement_start_response)
ResourceConflict: ' ('conflict', 'Document update conflict.')'

lib/ubuntuone/web/notes/views.py

The documents PUT in the db have no _rev, so all PUTs after the first will have a ResourceConflict.

The incorrect handling of ResourceConflicts in general is Bug#499301 .

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

What the heck. Here's what Snowy does:

http://git.gnome.org/browse/snowy/tree/api/handlers.py

        if update.has_key('latest-sync-revision'):
            new_sync_rev = update['latest-sync-revision']

        if new_sync_rev != current_sync_rev + 1:
            # TODO: Return a more useful error response?
            return rc.BAD_REQUEST

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

It's the same we do, but this is a tomboy-specific field, not the CouchDB _rev field

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

Rodrigo, right. I heard tomboy/Snowy refused uploads, and I wanted to know how it signaled that the request was invalid because of revision staleness, so that we could behave the same way. BAD_REQUEST doesn't have much meaning, and that surprised me.

Chad Miller (cmiller)
Changed in ubuntuone-servers:
assignee: nobody → Chad Miller (cmiller)
status: New → In Progress
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

Chad, btw, I submitted before the holidays this branch -> https://code.edge.launchpad.net/~rodrigo-moya/ubuntuone-servers/check-record-errors

It should catch the exceptions correctly, so feel free to approve/reject it if you've got a better fix

Chad Miller (cmiller)
description: updated
Chad Miller (cmiller)
Changed in ubuntuone-servers:
importance: Undecided → High
Elliot Murphy (statik)
visibility: private → public
Roman Yepishev (rye)
tags: added: christmas-bug
Revision history for this message
Sandy Armstrong (sanfordarmstrong) wrote :

The specific error codes returned are not yet well-defined in the Tomboy Web REST API spec. Contributions appreciated.

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

This is already fixed and deployed on the server

Changed in ubuntuone-servers:
status: In Progress → Fix Released
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.