[Zope] Zope pretends to receive and send XMLRPC data, but
strace sees nothing !
Pascal Peregrina
Pperegrina at Lastminute.com
Tue Jan 23 06:30:48 EST 2007
In general, retry is called when a ZODB Conflict Error has happened.
If I remember well, Zope will silently retry 3 times, and then actually
return an error page showing the Conflict Error.
Pascal
De : yacine chaouche <yacinechaouche at gmail.com>
Date : Tue, 23 Jan 2007 10:49:40 +0100
À : Gabriel Genellina <gagsl-zope at yahoo.com.ar>
Cc : <zope at zope.org>
Objet : Re: [Zope] Zope pretends to receive and send XMLRPC data, but strace
sees nothing ! (fwd)
Hello all,
>From times to times, apparently randomly, I have the following uncaught
exception in the console :
2007-01-23 10:41:07 ERROR ZServer uncaptured python exception, closing
channel <ZServer.HTTPServer.zhttp_channel connected 10.75.49.51:48177
<http://10.75.49.51:48177> at 0x44562e6c channel#: 140 requests:>
(socket.error:(104, 'Connection reset by peer')
[/opt/python2.4.2/lib/python2.4/asynchat.py|initiate_send|219]
[/opt/aef/Zope- 2.9.0/lib/python/ZServer/medusa/http_server.py|send|417]
[/opt/python2.4.2/lib/python2.4/asyncore.py|send|332])
In addition, i have edited this file
:Zope-2.9.0/lib/python/ZPublisher/HTTPRequest.py as follows :
<code>
def retry(self):
print "retry called in HTTPRequest for the",self.retry_count,"time"
self.retry_count=self.retry_count+1
self.stdin.seek(0)
r=self.__class__(stdin= self.stdin,
environ=self._orig_env,
response=self.response.retry()
)
r.retry_count=self.retry_count
return r
</code>
I only added a single print line to see if this method was called. And
indeed, it is ! Does anyone knows when (in what circumstances) this method
could be called ???
<console trace>
ip: 10.75.49.155 <http://10.75.49.155> requests counting of lines 11 to 21
ip: 10.75.49.51 <http://10.75.49.51> requests counting of lines 11 to 21
sending results to 10.75.49.155 <http://10.75.49.155>
sending results to 10.75.49.51 <http://10.75.49.51>
retry called in HTTPRequest for the 0 time
ip: 10.75.49.51 <http://10.75.49.51> requests counting of lines 11 to 21
</console trace>
Thanks.
Y.Chaouche
2007/1/19, yacine chaouche <yacinechaouche at gmail.com>:
> It writes and reads objects in the session, maybe the probleme comes from here
> ? Here's a little sinppet :
>
> def toutCompter(self):
> """
> xmlrpc methode, called from a web borwser.
> """
> documentXML = ComptageXML()
> #this reads and writes objects in the session
> dicoLignes = self._fabriquerDicoLignes()
> #do things with dicoLignes
> for inumLigneCourante in xrange(borneInf,borneSup) :
> snumLigneCourante = str(inumLigneCourante)
> ligne = dicoLignes[snumLigneCourante]["requete"]
> #do things here
> self._ajouterAuDico(snumLigneCourante,ligne,comptage,arbre)
>
> if ligne :
> self._mettreEnSession(resultats)
>
> response = self.REQUEST.RESPONSE
> response.setHeader("Content-Type","text/xml")
> response.setHeader ("charset","utf-8")
> chaineXML = documentXML.formatXML()
> print "sending results to "+addresseIP
> return chaineXML
>
> def _fabriquerDicoLignes(self):
> formulaire = self.getForm()
> dicoLignes = self.getSession(self,"dicoLignes") or {}
> for key in formulaire.keys():
> #do things...
> self.setSession("dicoLignes", dicoLignes)
> return dicoLignes
>
> def _fabriquerListeLignes(self):
> dicoLignes = RacineAbstraite.getSession(self,"dicoLignes") or {}
> listeNumeros = dicoLignes.keys()
> listeNumeros.sort ( lambda x,y: cmp(int(x), int(y)) )
> return [ dicoLignes[str(inumeroLigne)]["requete"] for inumeroLigne in
> \
> sorted( [int(snumeroLigne) for snumeroLigne in
> dicoLignes.keys()] ) ]
>
> def _ajouterAuDico(self,p_snumeroCle,p_ligne,p_comptage,p_arbre):
> dicoLignes = RacineAbstraite.getSession(self,'dicoLignes') or {}
> dicoLignes[p_snumeroCle] =
> {'requete':p_ligne,'comptage':p_comptage,'arbre':p_arbre}
> self.setSession('dicoLignes',dicoLignes)
>
> def _mettreEnSession(self,p_resultats):
> """
> Mettre en session les résultats d'un comptage.
> """
>
> # Initialise de la SESSION
> dicoResultatRecherche = {
> 'listeCriteres' : [self._fabriquerListeLignes(),
> self.getForm('numeroLigne')],
> 'nombreEntreprises' : p_resultats[0][0],
> 'listeComptage' : p_resultats,
> 'listeEntreprises' : [],
> }
> #On conserve la requete et le resultat en session
> self.setSession('resultatRecherche', p_dicoResultatRecherche.copy())
>
>
> When toutCompter is called by browser 1, then he will write and read, say, the
> dicoLignes object in the session.
> When toutCompter is called by browser 2 parallely, is it the same dicoLignes
> object that it tries to access or another one is created ? can there be
> conflicts somehow ?
>
> Y.Chaouche
>
> 2007/1/19, yacine chaouche < yacinechaouche at gmail.com
> <mailto:yacinechaouche at gmail.com> >:
>> I mean triple couples of lines of code.
>>
>> 2007/1/19, yacine chaouche < yacinechaouche at gmail.com
>> <mailto:yacinechaouche at gmail.com> >:
>>> The toutCompter methode does a lot of thing and it would take a triple
>>> couples of lines to describe what it does all.
>>> Anyway, is there a way for me to detect ConflictErrors ? they don't appear
>>> on the console so i guess they are catched.
>>>
>>> Y.Chaouche
>>>
>>> 2007/1/19, Gabriel Genellina <gagsl-zope at yahoo.com.ar
>>> <mailto:gagsl-zope at yahoo.com.ar> >:
>>>> At Thursday 18/1/2007 16:30, Andreas Jung wrote:
>>>>
>>>>
>>>>> <zope trace to the console>
>>>>> ip: 10.75.49.155 <http://10.75.49.155> requests counting of lines 1 to
>>>>> 11
>>>>> ip: 10.75.49.51 <http://10.75.49.51> requests counting of lines 1 to 11
>>>>> sending results to 10.75.49.155 <http://10.75.49.155>
>>>>> sending results to 10.75.49.51 <http://10.75.49.51>
>>>>> ip: 10.75.49.51 <http://10.75.49.51> requests counting of lines 1 to 11
>>>>> sending results to 10.75.49.51 <http://10.75.49.51>
>>>>> </zope trace>
>>>>>
>>>>>
>>>>> Zope says he got 2 requests form 10.75.49.51 <http://10.75.49.51> and
>>>>> sent it the results 2
>>>>> times. Ok, let's check the tcpflow then for these supposed connections :
>>>>> [...]
>>>>> Allright, there is only ONE POST request. So zope didnt really got two
>>>>> requests. Now let's see if it sent the data two times as it presumes :
>>>>> [...]
>>>>> The results were sent just one time, not two.
>>>>>
>>>>> What is going on here ?
>>>>
>>>> What does the toutCompter method really does? Does it modify some
>>>> object state? That might provoke a ConflictError, forcing a
>>>> transaction abort and the request to be re-tried (up to three times,
>>>> silently, then it goes logged).
>>>>
>>>>
>>>> --
>>>> Gabriel Genellina
>>>> Softlab SRL
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> __________________________________________________
>>>> Preguntá. Respondé. Descubrí.
>>>> Todo lo que querías saber, y lo que ni imaginabas,
>>>> está en Yahoo! Respuestas (Beta).
>>>> ¡Probalo ya!
>>>> http://www.yahoo.com.ar/respuestas <http://www.yahoo.com.ar/respuestas>
>>>>
>>>> _______________________________________________
>>>> Zope maillist - Zope at zope.org
>>>> http://mail.zope.org/mailman/listinfo/zope
>>>> <http://mail.zope.org/mailman/listinfo/zope>
>>>> ** No cross posts or HTML encoding! **
>>>> (Related lists -
>>>> http://mail.zope.org/mailman/listinfo/zope-announce
>>>> <http://mail.zope.org/mailman/listinfo/zope-announce>
>>>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>>
>>
>
_______________________________________________
Zope maillist - Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
More information about the Zope
mailing list