<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div apple-content-edited="true">Hi,
</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">My colleague is having the issue outlined below. I thought this list might be better to give an insight as to what is going on?</div>
<div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Adam Terrey <<a href="mailto:adam@pretaweb.com">adam@pretaweb.com</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>Fwd: Zope/Plone/Zeo Concurrency Issue</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">28 May 2013 5:23:33 PM AEST<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Dylan Jay <<a href="mailto:djay@pretaweb.com">djay@pretaweb.com</a>><br></span></div><br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<div bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-forward-container"><br>
<br>
-------- Original Message --------
<table class="moz-email-headers-table" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
</th>
<td>Zope/Plone/Zeo Concurrency Issue</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
<td>Tue, 28 May 2013 16:04:21 +1000</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
<td>Adam Terrey <a class="moz-txt-link-rfc2396E" href="mailto:adam@pretaweb.com"><adam@pretaweb.com></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
<td><a class="moz-txt-link-abbreviated" href="mailto:Zope@zope.org">Zope@zope.org</a></td>
</tr>
</tbody>
</table>
<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Hi,<br>
<br>
Can someone offer some insight into what might be going on here
and perhaps how I can debug the following issue?<br>
<br>
In Plone there is a request patten used to create content which
looks like...<br>
<ul>
<li>(A) GET request to /MySite/createObject?type_name=Document<br>
Responds with a redirect to a tempory document at a location
such as
/MySite/portal_factory/Document/document.2013-05-28.1878040976/edit</li>
<li>(B) GET
/MySite/portal_factory/Document/document.2013-05-28.1878040976/edit<br>
Responds with from to set fields in the Document<br>
</li>
<li>(C) POST request to
/MySite/portal_factory/Document/document.2013-05-28.1878040976/atct_edit<br>
Responds with a redirect to the final location of the document
such as /Mysite/my-page</li>
<li>(D) GET /Mysite/my-page<br>
Responds with the newly created page<br>
</li>
</ul><p>In one of our production systems we are running multiple
Zope/Plone instances connecting to a Zeo server. And the above
patten works about 95% of the time. However, sometimes request
(D) will respond with 404 Page Not Found. My assumptions is that
request (C) and (D) are going to different instances and somehow
the instance handling request (D) does not yet see the
transaction with completed the page creation.<br>
</p>
I've checked that the transaction commit happens before response
headers are emitted for request (C) - suspecting the case that the
browser handles the redirect before the transaction is completed -
but this is clearly not the case from what i can see. The
transaction is well committed before response headers are
returned.<br>
<br>
Versions are as follows:<br>
<ul>
<li>Plone 4.1.3 (4112)</li>
<li>CMF 2.2.4</li>
<li>Zope 2.13.10</li>
<li>Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1]</li>
</ul>
I have been using the following script to recreate the issue. I
seem to be able to produce the error quicker if I put server2
under apache-bench load, and I have been able to recreate the
issue on a local copy of our production system but it is a far
more rare case.<br>
<br>
auth = ('admin', 'admin')<br>
server1 = '<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://localhost:46101/">http://localhost:46101</a>'<br>
server2 = '<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://localhost:46102/">http://localhost:46102</a>'<br>
site = '/Plone'<br>
<br>
import requests<br>
<br>
ses = requests.Session()<br>
ses.auth=auth<br>
<br>
for i in range(10):<br>
<br>
# Create tempory Object<br>
create_url = server1 + site +
'/createObject?type_name=Document'<br>
print "GET", create_url<br>
res = ses.get (create_url)<br>
tempory_obj = res.url.rsplit("/", 1)[0]<br>
print "tempory object:", tempory_obj<br>
<br>
<br>
# Submit data to create object (response will<br>
# be the redirect ot the ojbect's location)<br>
<br>
data = {<br>
'id': '',<br>
'title': 'page' + str(i) ,<br>
'form.button.save': 'Save',<br>
'form.submitted': '1',<br>
"description": "some secriot",<br>
"text": "some text"<br>
}<br>
<br>
post_url = tempory_obj + "/atct_edit" <br>
print "POST", post_url<br>
res = ses.post(post_url, data=data, allow_redirects=False)<br>
<br>
redirect_location = "/" +
res.headers['location'][7:].split('/',1)[1]<br>
print 'redirect_location', redirect_location<br>
<br>
<br>
# Request object from the redirect from server2<br>
redirect_url = server2 + redirect_location<br>
print "GET", redirect_url <br>
res = ses.get(redirect_url)<br>
<br>
if res.status_code != 200:<br>
last404 = res<br>
print res;<br>
break;<br>
<br>
print "---"<br>
<br>
<br>
Any help would be appreciated.<br>
<br>
Regards,<br>
<br>
<div class="moz-signature">-- <br>
<div style="font-family:Geneva,Verdana;font-size:small"><p> <strong>Adam Terrey</strong><br>
Software Engineer<br>
PretaWeb </p><p> <a moz-do-not-send="true" href="mailto:adam@pretaweb.com">adam@pretaweb.com</a>
</p>
</div>
</div>
<br>
<br>
</div>
<br>
</div>
</blockquote></div><br></body></html>