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
error:
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')
log.close()
The output from the above is:
cache:[<unbound method Root.setName>, <unbound method Root.setLinuxName>,
<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:
http://www.users.qwest.net/~haaserd/Webware/Error-ShowPix.py-02-08-20.html
http://www.users.qwest.net/~haaserd/Webware/MiddleObject.py
I am running Webware version 7 with one fix to ServletFactory.py for another
threading problem.
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.
Roger Haase
|