--- On Sun, 11/2/08, Christoph Zwerschke <cito@...> wrote:
> From: Christoph Zwerschke <cito@...>
> Subject: Re: [Webware-discuss] MiddleKit Threading Error?
> To: crosseyedpenguin@..., "Discussion of Webware for Python including feedback and proposals." <webware-discuss@...>
> Date: Sunday, November 2, 2008, 3:14 PM
> Roger Haase schrieb:
> > My revised solution is to put the lock at the
> beginning and end of the method.
> I never used MiddleKit, so I don't know how to test
> this, but since it
> looks reasonable I've checked this in anyway, and
> cleaned up
> MiddleObject.py a bit. Can you check whether this works for
> Btw, I was trying to run the MiddleKit test suite, but I
> get many
> errors. For instance when running "python Test.py
> MKDelete" I get a
> "Lock wait timeout exceeded" (this hasn't
> anything to do with the lock
> in the patch, I get it also without your patch). Does the
> test suite run
> for you? If yes, on what OS, Py and database (driver)
> Also, while we're at it, can you or somebody else have
> a look at the
> following MiddleKit patches:
> There are a handful of other very old open issues here,
> mostly MiddleKit
> or other stuff I don't use. If anybody wants to work on
> Ideally I'd like to have a running MiddleKit test suite
> and most of the
> issues above solved before releasing 1.0.
> -- Christoph
I had to revise your new MiddleObject.py to put the
"_mk_cacheLock = threading.RLock()"
statement at the module level rather than in the MiddleObject __init__ method. A new MiddleObject instance is being created with each request so putting the lock inside the object instance does not force single-threading through the readStoreData method.
While doing some more testing, I found that the problem is largely dependent upon Firefox 3. I have a static web page with 12 images and graphs that are generated by individual calls to Webware/MiddleKit. To run the test that creates the conditions for failure, I must restart the AppServer, clear the browser cache, and reload the page.
Firefox 3 almost always causes the failure, Safari for Windows and Google Chrome rarely cause the failure, and IE 7 and Opera 9 never cause the failure (so far).
The MiddleKit test suite does not run for me either.
I will look over the 3 other 3 MiddleKit changes in the queue and update them for 1.0Rc1. It will probably take me about 2 weeks to get around to the task.