[Zope] RE: ZopeProfiler issue (found root cause)

Pascal Peregrina Pperegrina at Lastminute.com
Mon Jun 27 14:50:54 EDT 2005


Well, what about :

try:
    p= gP()
except:
    return 

;)

I will test your patch, not sure about the 
+    s_class = getattr(s, '__class__', None)
+    gpp_class = getattr(s, '__class__', None)
in your patch...

Pascal

-----Message d'origine-----
De : Dieter Maurer [mailto:dieter at handshake.de]
Envoyé : lundi 27 juin 2005 20:00
À : Pascal Peregrina
Cc : 'zope at zope.org'; Paul Chudleigh
Objet : Re: [Zope] RE: ZopeProfiler issue (found root cause)


Pascal Peregrina wrote at 2005-6-27 11:53 +0200:
>I just finished reading xmlrpclib.py and ZopeProfiler code.
>
>Here is the root cause of the issue :
>
>In my code :
> getattr(ServerProxy(self.url),self.rpc_method_expr) returns an
>xmlrpclib._Method object
>
>Then ZopeProfiler calls
>ZopeProfiler.ZopeProfiler.getHLFuncId(self,fn,frame), which contains:
>gP= getattr(s,'getPhysicalPath',None)
>
>So this calls xmlrpclib._Method.__getattr__, which is:
>    def __getattr__(self, name):
>        return _Method(self.__send, "%s.%s" % (self.__name, name))
>
>So this returns another xmlrpclib._Method object for a "getPhysicalPath"
RPC
>method
>
>Because gP is not None, ZopeProfiler then does :
>p= gP()
>
>And this makes an RPC method call on the service, and of course raises an
>Exception !

Nice analysis!

>So for my tests I hacked xmlrpclib._Method.__getattr__ to return None for
>'getPhysicalPath' :
>    def __getattr__(self, name):
>        if name=='getPhysicalPath':
>            return None
>        return _Method(self.__send, "%s.%s" % (self.__name, name))

You can do this easier:

    from xmlrpclib import _Method
    _Method.getPhysicalPath = None

Of course, any way, you will loose the possibility to
call "getPhysicalPath" via "XML-RPC".

>
>But a real fix will be needed on ZopeProfiler !

Try the attached patch.


-- 
Dieter



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



More information about the Zope mailing list