...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]
Not very frequent - 2 errors on Apr 6, 3 on Mar 31. It can also happen to Wiki pages (Mar 31 incident)
Moduleforgetracker.tracker_main:938in_update_ticket<<else:post.text+='\n\n' + change_textself.ticket.commit()ifany_sums:self.ticket.dirty_sums()>>self.ticket.commit()Moduleforgetracker.model.ticket:318incommit<<defcommit(self):VersionedArtifact.commit(self)ifself.version>1:hist=TicketHistory.query.get(artifact_id=self._id,version=self.version-1)>>VersionedArtifact.commit(self)Moduleallura.model.artifact:323incommit<<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))Moduleming.orm.ormsession:24ininner<<definner(session,*args,**kwargs):before(session,*args,**kwargs)result=func(session,*args,**kwargs)after(session,*args,**kwargs)returnresult>>result=func(session,*args,**kwargs)Moduleming.orm.ormsession:79ininsert_now<<@with_hooks('insert')definsert_now(self,obj,st):mapper(obj).insert(self,obj,st)self.imap.save(obj)>>mapper(obj).insert(self,obj,st)Moduleming.orm.mapped_class:47ininsert<<#Actuallyinsertthedocumentdoc=self.doc_cls(state.document)session.impl.insert(doc)if'_id' in doc:state.document['_id'] = doc._id>>session.impl.insert(doc)Moduleming.session:21inwrapper<<defwrapper(self,doc,*args,**kwargs):try:returnfunc(self,doc,*args,**kwargs)exceptpymongo.errors.OperationFailure,opf:opf.args=opf.args+(('doc: ' + str(doc)),)>>returnfunc(self,doc,*args,**kwargs)Moduleming.session:136ininsert<<data=dict(doc)doc.update(data)bson=self._impl(doc).insert(data,safe=True)ifbsonand'_id' not in doc:doc._id=bson>>bson=self._impl(doc).insert(data,safe=True)Modulepymongo.collection:270ininsert<<self.__database.connection._send_message(message.insert(self.__full_name,docs,check_keys,safe,kwargs),safe)ids=[doc.get("_id",None)fordocindocs]>>check_keys,safe,kwargs),safe)Modulepymongo.connection:642in_send_message<<response=self.__receive_message_on_socket(1,request_id,sock)returnself.__check_response_to_last_error(response)returnNoneexcept(ConnectionFailure,socket.error),e:>>returnself.__check_response_to_last_error(response)Modulepymongo.connection:611in__check_response_to_last_error<<if"code"inerror:iferror["code"]in[11000,11001]:raiseDuplicateKeyError(error["err"])else:raiseOperationFailure(error["err"],error["code"])>>raiseDuplicateKeyError(error["err"])
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Not very frequent - 2 errors on Apr 6, 3 on Mar 31. It can also happen to Wiki pages (Mar 31 incident)
Fixed with [#7647]
Related
Tickets:
#7647