Give Webware from the tip of CVS a try. From perusing the CVS tree, it
looks like many optimizations and improvements have been made to MiddleKit
between 0.7 and now.
I can't say for sure that your problem has been fixed, but it's worth a try.
And in any case, any attempt to fix the problem should start with the most
up-to-date version of MiddleKit.
I hope I'm wrong, but unfortunately I suspect that MiddleKit still needs
some further work in order to be fully thread-safe. In that case, you may
be able to work around thread-safety issues by using your own
threading.RLock objects in strategic places.
> -----Original Message-----
> From: Roger Haase [mailto:haaserd@...]
> Sent: Wednesday, August 21, 2002 1:03 AM
> To: webware-discuss@...
> Subject: [Webware-discuss] MiddleKit Threading Problem?
> I have finally had a repeat of the problem I last wrote about
> on July 20. I
> have a web page that is trying to load several images at once
> similar to:
> <img src="ShowPix?pid=4&tn=160">
> The ShowPix.py servlet does several MySQL calls, then loads a
> .jpg image from
> the filesystem, messes with it, and writes out the modified image.
> I haven't tried to do it yet, but I think I will be able to
> recreate the
> problem in a simple environment by initiating multiple
> servlets all of which
> try to access the same MySQL table row which is not yet
> present in any cache.
> In the latest episode, I had been in the final stages of
> testing a new
> servlet for about 20 minutes, when I ran the servlet that creates
> the web page containing the ShowPix transactions. Of 5
> images, only the
> second one succeeded, the other four failed on the
> MiddleObject.py assertion
> assert len(cache)+1==len(row)
> I had modified MiddleObject.py just before the failing line:
> if len(cache)+1<>len(row):
> log = open('/home/roger/MiddleObject.txt', 'a')
> log.write('cache:' + str(cache) + '\n')
> log.write('row:' + str(row) + '\n')
> The output from the above is:
> cache:[<unbound method Root.setName>, <unbound method
> <unbound method Root.setName>, <unbound method Root.setLinuxName>]
> row:(1L, 'D:/Pix/', '/mnt/win_d/Pix/')
> The "row" above is correct: serialNum 1, my Windows root
> directory name, and
> the same root linuxName used when I run under Linux. The
> cache seems to have
> been duplicated, with Root.setName and Root.setLinuxName
> appearing twice.
> The "cache" value is persistent and all attempts to access
> that row continue
> to fail until the AppServer is restarted.
> Note that the second transaction succeeded, as if the first
> transaction was
> stopped for I/O, the second blew past it, and the first transaction
> permanently trashed the "cache" when it resumed. This is
> very similar to the
> circumstances that occurred on 7/19 when 6 of 7 similar
> transactions failed
> with the second one succeeding.
> Further information is at:
I am running Webware version 7 with one fix to ServletFactory.py for another
I would be happy to test any untested coding suggestions from any MiddleKit
experts. I am pretty sure I can code a simple example which will replicate
the problem after a finite number of tries.
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
Webware-discuss mailing list