Re: [Zope-dev] recursion depth exceeded
Terry Kerr writes: > I am running a fairly high traffic Zope server where people occassionly ftp > files in and out of the server. > > Approximately once per week, the zope process will go to using 99%CPU and stay > like that untill it is restarted. The error shown in the stupid log file is: > > 2002-03-06T01:22:41 ERROR(200) ZServer uncaptured python exception, closing > channel > (exceptions.RuntimeError:maximum recursion depth exceeded > [/usr/local/lib/python2.1/asyncore.py|poll|104] > [/usr/local/lib/python2.1/asyncore.py|handle_write_event|393] > [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|handle_write|147] > [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|initiate_send|209] > [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|refill_buffer|190] > [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/ftp_server.py|close|179] > [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/ftp_server.py|close|903] > [/usr/local/lib/python2.1/asyncore.py|close|355] > [/usr/local/lib/python2.1/asyncore.py|del_channel|241] > . > [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] and so on... > > > Line 361 in asyncore.py is: > > 358# cheap inheritance, used to pass all other attribute > 359# references to the underlying socket object. > 360def __getattr__ (self, attr): > 361return getattr (self.socket, attr) Python's "getattr" is dangerous (being able to easily give you infinite loops): In your example, the problems happens when for some reason, the socket could not be created during the construction. Fortunately, there is a work around: Add a class level definition for "socket" before "__getattr__" socket= None def __getattr__(self,attr): return getattr(self.socket,attr) In your problematic case, this will raise an AttributeError instead of an "recursion depth exceeded". This is much better. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] recursion depth exceeded
Hi Terry, Terry Kerr wrote: > > I am running a fairly high traffic Zope server where people occassionly ftp > files in and out of the server. > > Approximately once per week, the zope process will go to using 99%CPU and stay > like that untill it is restarted. Since we've experienced identical problems on Linux, using Python 2.1.1, I suspect a Zope bug and so have submitted a collector entry: http://collector.zope.org/Zope/268 cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] recursion depth exceeded
Hi, I am running a fairly high traffic Zope server where people occassionly ftp files in and out of the server. Approximately once per week, the zope process will go to using 99%CPU and stay like that untill it is restarted. The error shown in the stupid log file is: 2002-03-06T01:22:41 ERROR(200) ZServer uncaptured python exception, closing channel (exceptions.RuntimeError:maximum recursion depth exceeded [/usr/local/lib/python2.1/asyncore.py|poll|104] [/usr/local/lib/python2.1/asyncore.py|handle_write_event|393] [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|handle_write|147] [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|initiate_send|209] [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|refill_buffer|190] [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/ftp_server.py|close|179] [/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/ftp_server.py|close|903] [/usr/local/lib/python2.1/asyncore.py|close|355] [/usr/local/lib/python2.1/asyncore.py|del_channel|241] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] [/usr/local/lib/python2.1/asyncore.py|__getattr__|361] and so on... Line 361 in asyncore.py is: 358# cheap inheritance, used to pass all other attribute 359# references to the underlying socket object. 360def __getattr__ (self, attr): 361return getattr (self.socket, attr) It hints to me that it is some sort of ftp server error that is causing the problem. I have looked into it, but most of it is over my head and I was hoping somebody could help. I have tried to reproduce the error, but without success. The server is: FreeBSD4.3 Zope 2.4.3 (from src) python 2.1.2 terry -- Terry Kerr ([EMAIL PROTECTED]) Chief Technical Officer Bizar Software Pty Ltd (www.bizarsoftware.com.au) +61 3 9530 9182 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Recursion
> There would seem to be two ways to 'fix' this, I'll leave it as an exercise > for the reader to discuss which is best. > > Option 1: > def foo(self,counter=None): > some code > if bar == somewhat: > self.foo(counter=some_int) Option 1 has a problem. If you give it a different name in dtml, e.g. bar and call it: then self is a reference to the folder and self.foo doesn't exist. If there is a different method 'foo' in the folder that other method will be called instead. > > Option 2: > def foo(self,counter=None): > some code > if bar == somewhat: > foo(self,counter=some_int) > This one should work as advertised. (Unless you redefine foo in the python module in which case you get what you deserve). -- Duncan Booth [EMAIL PROTECTED] int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? http://dales.rmplc.co.uk/Duncan ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Recursion
I'd imagine self would be missing. There would seem to be two ways to 'fix' this, I'll leave it as an exercise for the reader to discuss which is best. Option 1: def foo(self,counter=None): some code if bar == somewhat: self.foo(counter=some_int) Option 2: def foo(self,counter=None): some code if bar == somewhat: foo(self,counter=some_int) hth Phil [EMAIL PROTECTED] - Original Message - From: "Andre Schubert" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, May 26, 2000 9:02 AM Subject: [Zope-dev] Recursion > Hi, > > I'm writing a python Extension, which searches in any folder > recursively. > > This means the code: > > def foo(self,counter=None): > some code > if bar == somewhat: > foo(counter=some_int) > > When i run this through zope a error occours. Zope says expected 1 > argument got 0. > My question is what argument is missing. > > mfg as > > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Recursion
Hi, I'm writing a python Extension, which searches in any folder recursively. This means the code: def foo(self,counter=None): some code if bar == somewhat: foo(counter=some_int) When i run this through zope a error occours. Zope says expected 1 argument got 0. My question is what argument is missing. mfg as ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )