Matt Feifarek wrote: > | Hmmm. I just noticed that if an exception happens during > | respond(), sleep() > | doesn't get called (unless it's the new EndResponse > | exception which I just > | added). Should it? > > Really not sure. I don't really understand the deep magic of > the application > server. Can it hang threads if awake() is called but sleep() > never? I don't > really understand how important the symmetry is, but I always > have tried to > make sure to keep it "by the book" just in case.
It definitely doesn't hang threads or anything. For the most part the various objects' sleep() methods mainly just clear out references to other objects that were saved in attributes. Seems like the worst that would happen from skipping sleep() is that a cycle might be left behind to be collected by the garbage collector. But... > > When do things like re-pickling the session object happen? > That's the kind > of housekeeping that I'm afraid could get short circuited, > and it would be a > b*tch to identify and debug. ...this looks like the one exception what I wrote above. Application.sleep() tells the session store to save the transaction's session. This is a no-op for the Dynamic and Memory stores because pickling to disk happens in a background thread in Dynamic, and not at all in Memory (except on shutdown). But if you're using the File store, then this is where changes get pickled to disk. So skipping sleep() may cause all session variable modifications to be lost, but only if you're using the File store, which is generally a bad idea anyway. Note: I haven't tested what I wrote above -- this is based on code inspection only. I might have gotten it wrong. In any case, I'm starting to lean toward the philosophy of not using awake() and sleep() at all in my own code. That of course neatly sidesteps the issue of how endResponse() should be treated in awake() and sleep() :-) And it does now seem like a bug to me that when exceptions happen, sleep() is skipped. The current code in Application looks like this: try: self.awake(transaction) try: self.respond(transaction) except EndResponse: pass self.sleep(transaction) except EndResponse: pass but I think it should look like this: try: self.awake(transaction) try: try: self.respond(transaction) except EndResponse: pass finally: self.sleep(transaction) except EndResponse: pass In other words, if awake() has succeeded, you always call sleep() regardless of what kind of exception was raised. - Geoff ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss