[ZODB-Dev] Webkit Threading and ZODB 3.3a2: problems on Windows

Matt Feifarek matt at dalchemy.com
Thu Feb 19 18:16:22 EST 2004


Jeremy Hylton wrote:

>You can ask for certain whether changes were made and avoid any question
>of your own certainty.
>  
>
Well, we do... but I don't trust the _p_changed flag, because it seems 
to just start showing up even if no changes have been made by our app. 
But I should watch in a debugger to make sure... that's a clue I'll follow.

>You should actually close the connection -- call the close() method.  
>  
>
Oh yes, sorry. We definitely do that. I forgot to write in the last note.

>Just before you close the connection, add some variant of this code
>
>    assert not get_transaction()._objects
>
>The _objects attribute stores all the objects registered with the
>transaction.  If you haven't modified anything, the list will be empty. 
>If you have modified something, the assertion will fail.
>  
>
Great idea. I tried that, and it gave me a couple of good clues to follow.

>How does the servlet get its original reference to the connection?  I
>assume it calls the open() method on the database at the start of each
>request.  (Just checking, because I haven't seen any code.)
>  
>
Exactly.

>The transaction is normally associated with a thread.  If a thread
>begins a transaction but does not finish it, then subsequent calls to
>get_transaction() will return the old, in-progress transaction.
>
A side note: the documentation suggests (or at least suggests enough 
that we misunderstood it) that unless you do a .commit() your changes 
are not saved. What I'm learning through everyone's expertise and advice 
is that objects can be corrupted even if you don't call commit(). It 
seems that one should definitely call commit() or abort() every time.

I'll keep everyone posted. Thanks so much; this has been extraordinary.



More information about the ZODB-Dev mailing list