[CRITICAL] data loss: FileStorage._commitVersion broken (was: [Zope] Problem committing zope "version" objects)
Dieter Maurer
dieter@handshake.de
Tue, 3 Jun 2003 23:52:32 +0200
--H1xTWO4y6U
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit
Attention: cross post
Warnes, Gregory R wrote at 2003-6-3 10:37 -0400:
> ...
> If I create a file, performing a "Save" appears to have no effect.
> All modified/created/delete objects remain locked by the version.
>
> Is this a general problem with Zope?
It is a bug in "FileStorage._commitVersion", hopefully fixed
by the attached patch.
The object records belonging to a version form a linked list
via the "pv" link field. The head of the list is pointed
to by "fs._vindex[version]".
When the version is committed or aborted, the linked list must
be traversed to determine the set of objects modified in this
version.
Apparently, someone misinterpreted the traversal loop (which looks for
objects belonging to the version) as following some backpointers
and left the loop as soon as the first object was found.
As a consequence, just this one object was moved from the
version, all other objects (if any) remained with the old version
(and therefore remained locked). As the code expected to
commit (or abort) the complete version, "fs._vindex[version]" was
later deleted such that the version appeared to be empty while
there were still records associated with the version.
This is a critical bug, that should soon be fixed.
Dieter
--H1xTWO4y6U
Content-Type: application/x-patch
Content-Description: Patch to "ZODB/FileStorage.py"
Content-Disposition: attachment;
filename="Version.pat"
Content-Transfer-Encoding: base64
LS0tIDo6OkZpbGVTdG9yYWdlLnB5CTIwMDMtMDQtMTQgMTU6MDg6MzAuMDAwMDAwMDAwICsw
MjAwCisrKyBGaWxlU3RvcmFnZS5weQkyMDAzLTA2LTAzIDIzOjI4OjA4LjAwMDAwMDAwMCAr
MDIwMApAQCAtNTcyLDcgKzU3MiwxMyBAQAogICAgICAgICAgICAgICAgIGN1cnJlbnRfb2lk
c1tvaWRdID0gMQogICAgICAgICAgICAgICAgICMgT25jZSB3ZSd2ZSBmb3VuZCB0aGUgZGF0
YSB3ZSBhcmUgbG9va2luZyBmb3IsCiAgICAgICAgICAgICAgICAgIyB3ZSBjYW4gc3RvcCBj
aGFzaW5nIGJhY2twb2ludGVycy4KLSAgICAgICAgICAgICAgICBicmVhaworCisgICAgICAg
ICAgICAgICAgIyBETTogdGhlIGZvbGxvd2luZyAiYnJlYWsiIGJyb2tlIHZlcnNpb24gY29t
bWl0CisgICAgICAgICAgICAgICAgIyAgICAgYmVjYXVzZSBpdCBlZmZlY3RpdmVseSByZXN0
cmljdGVkIHRoZSB2ZXJzaW9uCisgICAgICAgICAgICAgICAgIyAgICAgdG8gYSBzaW5nbGUg
b2JqZWN0CisgICAgICAgICAgICAgICAgIyAgICAgV2UgYXJlICpOT1QqIGNoYXNpbmcgYmFj
a3BvaW50ZXJzIGhlcmUKKyAgICAgICAgICAgICAgICAjICAgICBidXQgIm9pZHMiIGJlbG9u
Z2luZyB0byB0aGUgdmVyc2lvbgorICAgICAgICAgICAgICAgICMgYnJlYWsKIAogICAgICAg
ICAgICAgZWxzZToKICAgICAgICAgICAgICAgICAjIEhtLiAgVGhpcyBpcyBhIG5vbi1jdXJy
ZW50IHJlY29yZC4gIElzIHRoZXJlIGEK
--H1xTWO4y6U--