[Webware-discuss] Re: [ZODB-Dev] Webkit Threading and ZODB 3. 3a2: problems on Windows

Geoffrey Talvola gtalvola at nameconnector.com
Thu Feb 19 16:22:14 EST 2004


Matt Feifarek wrote:
> On Thu, Feb 19, 2004 at 02:17:59PM -0500, Geoffrey Talvola wrote:
>> It seems to me that as long as you're not storing ZODB-managed data
>> IN the servlet instance somehow, this would cause no problems.
> 
> We are keeping a reference to ZODB-managed data throughout
> awake/sleep, but we always nullify it before sleep is done. (We set
> all zodb and object references to None) When the servlet goes back to
> the pool, it should have no references to any zodb stuff, unless zodb
> is sneaking something in via some of its deep-magic plumbing.
> 
> Thanks for the help.

Aha.  Exceptions can definitely cause sleep() to be skipped.

If an exception happens during respond() or during awake() then sleep() does
not get called.  This smells like a bug to me.

The code in question is in Application.py:

        try:
            self.awake(transaction)
            try:
                self.respond(transaction)
            except EndResponse:
                pass
            self.sleep(transaction)
        except EndResponse:
            pass

Looking at this more closely, there ought to be a try/finally in there so
that sleep() always gets called if awake() succeeds, something like:

        try:
            self.awake(transaction)
            try:
                self.respond(transaction)
            finally:
                self.sleep(transaction)
        except EndResponse:
            pass

Or perhaps sleep should always get called even if there is an exception in
awake():

        try:
            try:
                self.awake(transaction)
                self.respond(transaction)
            finally:
                self.sleep(transaction)
        except EndResponse:
            pass

- Geoff



More information about the ZODB-Dev mailing list