On Wed, Jan 05, 2011 at 08:24:56PM +0200, Marius Gedminas wrote:
Is anyone using RAMSessionDataContainer? I've a suspicion that it is utterly broken with modern ZODB versions.
If I'm not mistaken, MVCC requires you to either call connection.sync() or open a new connection for every request -- otherwise MVCC invalidations don't get processed and you always see old versions of cached objects.
RAMSessionDataContainer keeps an open connection for every thread, and that connection is never closed, never synced.
And that's fine, since Connection had afterTransaction and newTransaction hooks which perform a MVCC sync on transaction boundaries. I missed that when I was reading the source the first time. Now I've no explanation at all for these:
2011-01-05T10:42:21 WARNING ZopePublication Competing writes/reads at {URL}: database conflict error (oid 0x54, class BTrees.OOBTree.OOBTree, serial this txn started with 0x038b65ac32bee222 2011-01-05 15:40:11.893509, serial currently committed 0x038b65ae561f1999 2011-01-05 15:42:20.184723) ------ 2011-01-05T10:42:21 WARNING ZopePublication Competing writes/reads at {URL}: database conflict error (oid 0x54, class BTrees.OOBTree.OOBTree, serial this txn started with 0x038b65ac32bee222 2011-01-05 15:40:11.893509, serial currently committed 0x038b65ae561f1999 2011-01-05 15:42:20.184723) ------ 2011-01-05T10:42:21 WARNING ZopePublication Competing writes/reads at {URL}: database conflict error (oid 0x54, class BTrees.OOBTree.OOBTree, serial this txn started with 0x038b65ac32bee222 2011-01-05 15:40:11.893509, serial currently committed 0x038b65ae561f1999 2011-01-05 15:42:20.184723) ------ 2011-01-05T10:42:21 WARNING ZopePublication Competing writes/reads at {URL}: database conflict error (oid 0x54, class BTrees.OOBTree.OOBTree, serial this txn started with 0x038b65ac32bee222 2011-01-05 15:40:11.893509, serial currently committed 0x038b65ae561f1999 2011-01-05 15:42:20.184723) ------ 2011-01-05T10:42:21 ERROR SiteError {URL} Traceback (most recent call last): File "/home/zope/eggs/zope.publisher-3.12.4-py2.6.egg/zope/publisher/publish.py", line 137, in publish publication.afterCall(request, obj) File "/home/zope/eggs/zope.app.publication-3.12.0-py2.6.egg/zope/app/publication/browser.py", line 48, in afterCall super(BrowserPublication, self).afterCall(request, ob) File "/home/zope/eggs/zope.app.publication-3.12.0-py2.6.egg/zope/app/publication/zopepublication.py", line 215, in afterCall txn.commit() File "/home/zope/eggs/transaction-1.1.1-py2.6.egg/transaction/_transaction.py", line 329, in commit self._commitResources() File "/home/zope/eggs/transaction-1.1.1-py2.6.egg/transaction/_transaction.py", line 443, in _commitResources rm.commit(self) File "/home/zope/eggs/ZODB3-3.9.7-py2.6-linux-i686.egg/ZODB/Connection.py", line 566, in commit self._commit(transaction) File "/home/zope/eggs/ZODB3-3.9.7-py2.6-linux-i686.egg/ZODB/Connection.py", line 614, in _commit self._store_objects(ObjectWriter(obj), transaction) File "/home/zope/eggs/ZODB3-3.9.7-py2.6-linux-i686.egg/ZODB/Connection.py", line 666, in _store_objects s = self._storage.store(oid, serial, p, '', transaction) File "/home/zope/eggs/ZODB3-3.9.7-py2.6-linux-i686.egg/ZODB/utils.py", line 255, in __call__ return func(*args, **kw) File "/home/zope/eggs/ZODB3-3.9.7-py2.6-linux-i686.egg/ZODB/MappingStorage.py", line 258, in store oid=oid, serials=(old_tid, serial), data=data) ConflictError: database conflict error (oid 0x54, class BTrees.OOBTree.OOBTree, serial this txn started with 0x038b65ac32bee222 2011-01-05 15:40:11.893509, serial currently committed 0x038b65ae561f1999 2011-01-05 15:42:20.184723)
Note how "serial this txn started with" doesn't change in all the retries.
Any ideas? Marius Gedminas -- http://pov.lt/ -- Zope 3/BlueBream consulting and development