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

Dieter Maurer dieter at handshake.de
Mon Jun 27 14:00:08 EDT 2005


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ZopeProfiler.pat
Type: text/x-python
Size: 847 bytes
Desc: patch for "xmlrpclib" problem
Url : http://mail.zope.org/pipermail/zope/attachments/20050627/598b9d8f/ZopeProfiler.py


More information about the Zope mailing list