#1903 Tickets can get into a weird state where they can't save a snapshot on change

v1.2.0
closed
nobody
sf-2 (994)
General
nobody
2015-08-20
2011-04-06
Wolf
No

...and this leads to a 500 result from clicking the 'Save' button. The actual problem is a duplicate key in saving the snapshot -- a snapshot already exists with the version number the ticket thinks it should have. Observed on [#1876]

Related

Tickets: #1876

Discussion

  • Dave Brondsema

    Dave Brondsema - 2011-04-07

    Not very frequent - 2 errors on Apr 6, 3 on Mar 31. It can also happen to Wiki pages (Mar 31 incident)

    Module forgetracker.tracker_main:938 in _update_ticket
    <<          else:
                       post.text += '\n\n' + change_text
                   self.ticket.commit()
                   if any_sums:
                       self.ticket.dirty_sums()
    >>  self.ticket.commit()
    Module forgetracker.model.ticket:318 in commit
    <<      def commit(self):
                   VersionedArtifact.commit(self)
                   if self.version > 1:
                       hist = TicketHistory.query.get(artifact_id=self._id, version=self.version-1)
    >>  VersionedArtifact.commit(self)
    Module allura.model.artifact:323 in commit
    <<              data=state(self).document.deinstrumented_clone())
                   ss = self.__mongometa__.history_class(**data)
                   session(ss).insert_now(ss, state(ss))
                   log.info('Snapshot version %s of %s',
                            self.version, self.__class__)
    >>  session(ss).insert_now(ss, state(ss))
    Module ming.orm.ormsession:24 in inner
    <<          def inner(session, *args, **kwargs):
                       before(session, *args, **kwargs)
                       result = func(session, *args, **kwargs)
                       after(session, *args, **kwargs)
                       return result
    >>  result = func(session, *args, **kwargs)
    Module ming.orm.ormsession:79 in insert_now
    <<      @with_hooks('insert')
               def insert_now(self, obj, st):
                   mapper(obj).insert(self, obj, st)
                   self.imap.save(obj)
    >>  mapper(obj).insert(self, obj, st)
    Module ming.orm.mapped_class:47 in insert
    <<          # Actually insert the document
                   doc = self.doc_cls(state.document)
                   session.impl.insert(doc)
                   if '_id' in doc:
                       state.document['_id'] = doc._id
    >>  session.impl.insert(doc)
    Module ming.session:21 in wrapper
    <<      def wrapper(self, doc, *args, **kwargs):
                   try:
                       return func(self, doc, *args, **kwargs)
                   except pymongo.errors.OperationFailure, opf:
                       opf.args = opf.args + (('doc:  ' + str(doc)),)
    >>  return func(self, doc, *args, **kwargs)
    Module ming.session:136 in insert
    <<              data = dict(doc)
                   doc.update(data)
                   bson = self._impl(doc).insert(data, safe=True)
                   if bson and '_id' not in doc:
                       doc._id = bson
    >>  bson = self._impl(doc).insert(data, safe=True)
    Module pymongo.collection:270 in insert
    <<          self.__database.connection._send_message(
                       message.insert(self.__full_name, docs,
                                      check_keys, safe, kwargs), safe)
    
                   ids = [doc.get("_id", None) for doc in docs]
    >>  check_keys, safe, kwargs), safe)
    Module pymongo.connection:642 in _send_message
    <<                  response = self.__receive_message_on_socket(1, request_id,
                                                                       sock)
                           return self.__check_response_to_last_error(response)
                       return None
                   except (ConnectionFailure, socket.error), e:
    >>  return self.__check_response_to_last_error(response)
    Module pymongo.connection:611 in __check_response_to_last_error
    <<          if "code" in error:
                       if error["code"] in [11000, 11001]:
                           raise DuplicateKeyError(error["err"])
                       else:
                           raise OperationFailure(error["err"], error["code"])
    >>  raise DuplicateKeyError(error["err"])
    
     
  • Dave Brondsema

    Dave Brondsema - 2011-04-07
    • size: --> 2
     
  • Dave Brondsema

    Dave Brondsema - 2015-08-17
    • status: open --> closed
    • Milestone: unreleased --> asf_release_1.2.0
     
  • Dave Brondsema

    Dave Brondsema - 2015-08-17

    Fixed with [#7647]

     

    Related

    Tickets: #7647


Log in to post a comment.