[Zope3-dev] Fix for request retry on ConflictError

Jim Fulton jim at zope.com
Tue Jul 18 10:04:54 EDT 2006


A test is not required, although it would be helpful.

There may, possibly, be existing tests that you could extend.

Also, you shouldn't generate a real ZODB conflict error to test this.
Rather, you should generate a conflict error in your test directly.

Jim

On Jul 18, 2006, at 9:46 AM, Sven Schomaker wrote:

> Jim Fulton wrote:
>> PLease submit a collector issue at:
>>
>>   http://www.zope.org/Collectors/Zope3-dev
>>
>> A test would be especially helpful.
>>
> Yeehaw, I was afraid someone would ask for such a thing.
> I must admit I actually wasn't able to write it up to now,
> since I'm not too familiar with all the traversal stuff and
> the like and howto setup a test for that issue.
>
> Poor me - I figured out the solution by torturing our app
> with a bunch of simultaneous requests and provoking
> some ConflictErrors.
>
> Since that is not helpful at all, someone may help me on
> writing a formal test?
>
> greetings,
>
> Sven
>
>> Jim
>>
>> On Jul 18, 2006, at 4:28 AM, Sven Schomaker wrote:
>>
>>> Hi all,
>>>
>>> the retry of a request in case of a ConflictError in Zope 3.2.1  
>>> fails
>>> with a NotFound error, while looking up the requested view in
>>> zope/app/traversing/namespace.py (line 362).
>>>
>>> It seems as the newly created request (in request.retry()) does
>>> somehow not satisfy the adapter prerequisites to successfully
>>> look up a view in zope.component.queryMultiadapter.
>>>
>>> I did not dig too deep to find out what exactly goes wrong in the  
>>> old
>>> statement used to create the new request instance, but I suppose
>>> somehow not all specifications (interfaces) of the original request
>>> are set up on the new request. Nevertheless I came up with a (quick)
>>> fix in zope/publisher/http.py that circumvents the issue.
>>>
>>> I don't know whether this is already fixed in the trunk or the fix
>>> appeals to the devs with check-in permissions, but maybe someone
>>> wants to look at it and check it in (or comes up with a better/more
>>> precise one:)).
>>>
>>>
>>> greetings,
>>>
>>> Sven Schomaker
>>>
>>>
>>> Index: http.py
>>> ===================================================================
>>> --- http.py     (revision 178)
>>> +++ http.py     (working copy)
>>> @@ -15,6 +15,7 @@
>>>
>>> $Id: http.py 41004 2005-12-23 21:01:20Z jim $
>>> """
>>> +from copy import copy
>>> import re, time, random
>>> from cStringIO import StringIO
>>> from urllib import quote, unquote, splitport
>>> @@ -435,13 +436,12 @@
>>>         'See IPublisherRequest'
>>>         count = getattr(self, '_retry_count', 0)
>>>         self._retry_count = count + 1
>>> -
>>> -        new_response = self.response.retry()
>>> -        request = self.__class__(
>>> +        request = copy(self)
>>> +        request.__init__(
>>>             # Use the cache stream as the new input stream.
>>>             body_instream=self._body_instream.getCacheStream(),
>>>             environ=self._orig_env,
>>> -            response=new_response,
>>> +            response=self.response.retry(),
>>>             )
>>>         request.setPublication(self.publication)
>>>         request._retry_count = self._retry_count
>>>
>>> _______________________________________________
>>> Zope3-dev mailing list
>>> Zope3-dev at zope.org
>>> Unsub: http://mail.zope.org/mailman/options/zope3-dev/jim%40zope.com
>>>
>>
>> -- 
>> Jim Fulton            mailto:jim at zope.com        Python Powered!
>> CTO                 (540) 361-1714            http://www.python.org
>> Zope Corporation    http://www.zope.com        http://www.zope.org
>>
>>
>>
>
>
> -- 
> __________________Addressed by:_________________
>
> Sven Holger Cochise Schomaker, Dipl.-Inf. (FH)
>
> Linie M - Metall Form Farbe - GmbH
> Industriestrae 8
> 63674 Altenstadt (Hessen)
> Germany
>
> Tel.: +49 (0)6047 97121
> Fax: +49 (0)6047 97122
>
> Mail: sven.schomaker at linie-m.de
>
> Public Key: hkp://subkeys.pgp.net
>
> Key ID: F04D3E4F
>
> Key fingerprint: 79BD FBEB F6AE 7005 8374                  320A  
> 0D13 F202 F04D 3E4F
>
> _______________________________________________
>

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the Zope3-dev mailing list