[Zope] Double and Triple Posts

Andy Yates andy at nnu.com
Tue Mar 15 22:06:34 EST 2005


I have a form that posts to a python script which can take several
seconds to run.  Sometimes the script gets called 2 or 3 times in the
same request.  It is not easy to reproduce but it seems to happen at
least once every 20 requests.  This is happening on two different
versions of Zope and in two completely different projects.

 

Zope only logs a single request.  However, I know it is getting called
more than once because the script writes to syslog.  

 

I've packet sniffed the browser and it is only sending one post.  It
happens in IE and FireFox but seems to be easier to reproduce in IE.  IE
will let you click more than once on the submit button.  When I click
the submit button twice sometimes I get 3 or 4 runs of the script.  I
would expect to get only two.  It seems to happen much more often when I
do this.  (FireFox will only let you press the submit button once)

 

It seems to happen if the script reads and writes values to
context.REQUEST.SESSION.  When I take this out it seems to stop.  (It
can be hard to reproduce)

 

To reproduce this I created a script that calls an external method to
syslog a message.  Then it reads and writes to context.REQUEST.SESSION.
Then it calls another external method to sleep 15 seconds.   Finally it
prints a message and returns.

 

 

I see this behavior on Zope-2.7.3 and Zope-2.6.1.  

 

 

context.zsyslog('Snooze test' )

 

foo = context.REQUEST.SESSION.get('foo', 1)

if foo==1 :

    context.REQUEST.SESSION.set('foo', 0)

 

context.REQUEST.SESSION.set('bar',123)

 

context.Snooze(15)

 

print "I'm awake now!"

return printed

 

Please let me know if this is happening anywhere else.  

 

Andy

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050315/094e16aa/attachment.htm


More information about the Zope mailing list