mgedmin / zodbbrowser

ZODB browser
http://launchpad.net/zodbbrowser
Other
19 stars 6 forks source link

KeyError: ... did not exist in or before transaction ... #29

Closed mgedmin closed 5 years ago

mgedmin commented 5 years ago

I was paging through http://localhost:8070/@@zodbbrowser_history of a database converted to Python 3 with zodbupdate and I got a system error page with this traceback:

``` Traceback (most recent call last): File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/publisher/publish.py", line 144, in publish result = publication.callObject(request, obj) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/app/publication/zopepublication.py", line 206, in callObject return mapply(ob, request.getPositionalArguments(), request) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/publisher/publish.py", line 119, in mapply return debug_call(obj, args) - __traceback_info__: > File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/publisher/publish.py", line 125, in debug_call return obj(*args) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/browser.py", line 105, in __call__ return self.render() File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/browser.py", line 472, in render return self.template() File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/browserpage/viewpagetemplatefile.py", line 81, in __call__ return self.__func__(im_self, *args, **kw) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/browserpage/viewpagetemplatefile.py", line 49, in __call__ sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0), File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/pagetemplate/pagetemplate.py", line 135, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/pagetemplate/pagetemplate.py", line 265, in __call__ interpreter() File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 272, in __call__ self.interpret(self.program) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 344, in interpret handlers[opcode](self, args) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 902, in do_useMacro self.interpret(macro) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 344, in interpret handlers[opcode](self, args) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 534, in do_optTag_tal self.do_optTag(stuff) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 519, in do_optTag return self.no_tag(start, program) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 514, in no_tag self.interpret(program) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 344, in interpret handlers[opcode](self, args) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 871, in do_defineMacro self.interpret(macro) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 344, in interpret handlers[opcode](self, args) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 962, in do_defineSlot self.interpret(slot) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 344, in interpret handlers[opcode](self, args) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 534, in do_optTag_tal self.do_optTag(stuff) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 519, in do_optTag return self.no_tag(start, program) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 514, in no_tag self.interpret(program) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 344, in interpret handlers[opcode](self, args) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tal/talinterpreter.py", line 828, in do_loop_tal iterator = self.engine.setRepeat(name, expr) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tales/tales.py", line 755, in setRepeat expr = self.evaluate(expr) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tales/tales.py", line 775, in evaluate return expression(self) - /home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/templates/zodbhistory.pt - Line 31, Column 4 - Expression: - Names: {'args': (), 'context': >, 'default': , 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': , 'template': , 'view': , 'views': } File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tales/expressions.py", line 235, in __call__ return self._eval(econtext) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zope/tales/expressions.py", line 229, in _eval return ob() File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/browser.py", line 529, in listHistory path=getObjectPath(obj, d.tid), File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/browser.py", line 595, in getObjectPath state = state.getParentState() File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/state.py", line 149, in getParentState return ZodbObjectState(parent, self.requestedTid) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/state.py", line 95, in __init__ self._load() File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/state.py", line 98, in _load self.tid = self.history.lastChange(self.requestedTid) File "/home/mg/Private/ivija-staging/env3/lib/python3.5/site-packages/zodbbrowser/history.py", line 79, in lastChange (self._obj, tid_repr(tid))) KeyError: "> did not exist in or before transaction '0x03d16b98bb090566'" ```

AFAIU what happened was that zodbupdate splits the conversion into multiple transactions arbitrarily, and doesn't do a topological sort to guarantee that any objects references from some object will be present in the same or in some older transaction.