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

Tim Peters tim at zope.com
Thu Feb 19 15:00:36 EST 2004


[Matt Feifarek]
> Yes, no two threads can ever have the same tid, but what about when a
> servlet runs, doesn't .commit() or .abort(), and 10 minutes later, it
> runs again?
>
> Same tid, different objects, different circumstances, maybe this time
> there's a change to commit?

I can't guess.  It depends on (at least) three things I don't know:

1) When the servlet runs again 10 minutes later, is it running in the
   same thread it ran in before, or in a different thread?

2) If the answer to #1 is "the same thread", did the servlet happen to
   run in any other threads between the consecutive times you know it
   ran in this single thread?

3) *Would* a commit() or abort(), right before the servlet was put to
   sleep, have done something, had commit() or abort() been called?

Since you originally said the problem went away if you:

> 2) add a seemingly superfluous get_transaction().abort() call just
>    before the servlet is put to sleep (and before the database
>    connection is closed) by the app server;

then the best guess I can make is that the answer to #3 is "yes", the answer
to #1 is "different threads", and then things are screwed up for reasons
Shane explained.  If you, e.g., mutate a persistent object P, bound to
something.someattr, then merely rebinding something.someattr to None doesn't
change that the transaction still has a change to P pending -- you need to
commit that change, or abort it, and from the thread that made that
mutation.

There's still no reason in this scenario for why it *can't* fail on Linux
too, but reason to believe it would fail more frequently on Windows (and
possibly much more frequently on Windows).




More information about the ZODB-Dev mailing list