[Zope-dev] Zope multitasking: retrying doesn't seem to help at all
gtk
gtk@well.com
Fri, 5 Nov 1999 23:17:17 +1100
I've hacked HTTPRequest.py in 2.1 beta to give me some status, and I'm still
not sure that Zope's retrying operation is going to be any help, here. I'm
not exceeding the retry count, and Zope is still returning wierd errors to
my clients.
Here's one run output from trying to shove lots of documents with different
IDs into a single folder at once:
------
1999-11-05T11:58:29 ERROR(200) ZODB Couldn't load state for
'\000\000\000\000\00
0\000\006\202'
------
1999-11-05T11:58:29 ERROR(200) ZODB Couldn't load state for
'\000\000\000\000\00
0\000\006\202'
No retry action whatsoever, and I got two 404 errors back instead of created
folders.
Here's another:
------
1999-11-05T12:00:22 INFO(0) Z2 CONFLICT Competing writes at,
/folder1/testfolder
/manage_addProduct/OFSP/addDTMLDocument
------
1999-11-05T12:00:22 INFO(0) Z2 CONFLICT Competing writes at,
/folder1/testfolder
/manage_addProduct/OFSP/addDTMLDocument
retry count is 0 of 3
retrying...
retry count is 0 of 3
retrying...
------
1999-11-05T12:00:23 INFO(0) Z2 CONFLICT Competing writes at,
/folder1/testfolder
/manage_addProduct/OFSP/addDTMLDocument
retry count is 0 of 3
retrying...
------
1999-11-05T12:00:23 INFO(0) Z2 CONFLICT Competing writes at,
/folder1/testfolder
/manage_addProduct/OFSP/addDTMLDocument
retry count is 0 of 3
retrying...
Okay, so my code hacked into HTTPRequest is working. Note how I'm never
exceeding a retry count. At the client end, I got four 400 responses this
time, along the lines of:
Invalid request
The parameter, id, was omitted from the request.
Make sure to specify all required parameters, and try the request again.
Four Z2 conflicts, cool. Four retries, cool. Four errors to the client, not
cool.
Here are the mods to HTTPRequest:
def supports_retry(self):
stderr.write("retry count is %d of %d\n" % (self.retry_count,
self.retry_max_count))
return self.retry_count < self.retry_max_count
def retry(self):
stderr.write("retrying...\n")
self.retry_count=self.retry_count+1
r=self.__class__(stdin=self.stdin,
environ=self._orig_env,
response=self.response.retry()
)
return r
... and an appropriate import at the top.
Hmmm. You know, I can't see anything in the code which suggests that the
creation of a new request object in retry() makes any attempt to set its
retry_count. So, hacking in some new code:
retry_max_count=3
def supports_retry(self):
stderr.write("retry count is %d of %d\n" % (self.retry_count,
self.retry_max_count))
return self.retry_count < self.retry_max_count
def retry(self):
stderr.write("retrying...\n")
self.retry_count=self.retry_count+1
r=self.__class__(stdin=self.stdin,
environ=self._orig_env,
response=self.response.retry(),
retry_count=self.retry_count
)
return r
def __init__(self, stdin, environ, response, clean=0, retry_count=0):
# ...
if retry_count:
stderr.write("this is retry %d\n" % retry_count)
self.retry_count = retry_count
1999-11-05T12:14:51 INFO(0) ZServer Monitor Server (V1.5) started on port
8099
------
1999-11-05T12:14:59 ERROR(200) ZODB Couldn't load state for
'\000\000\000\000\00
0\000\006\265'
------
1999-11-05T12:15:00 ERROR(200) ZODB Couldn't load state for
'\000\000\000\000\00
0\000\006\265'
------
1999-11-05T12:15:01 INFO(0) Z2 CONFLICT Competing writes at,
/folder1/testfolder
/manage_addProduct/OFSP/addDTMLDocument
retry count is 0 of 3
retrying...
this is retry 1
Looks like I'm still not exceeding my retry count. That run had two 404s and
a 400. I guess the conflicts are the 400s and the 404s are something wierd.
Anyone know what's going on, here?
Regards,
Garth.
--
<gtk@well.com>