New issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum recursion depth
exceeded
http://code.google.com/p/pyftpdlib/issues/detail?id=188
my ftp.py codes:
import sys
import os
import time
from pyftpdlib import ftpserver
now = lambda: time.strftime("[%Y-%m-%d %H:%M:%S]")
f1 = open('ftpd.log', 'a')
f2 = open('ftpd.lines.log', 'a')
f3 = open('ftpd.error.log', 'a')
def standard_logger(msg):
f1.write("%s %s\n" %(now(), msg))
f1.flush()
def line_logger(msg):
f2.write("%s %s\n" %(now(), msg))
f2.flush()
def error_logger(msg):
f3.write("%s %s\n" %(now(), msg))
f3.flush()
def main(argv):
ftpserver.log = standard_logger
ftpserver.logline = line_logger
ftpserver.logerror = error_logger
if(len(argv)!=2):
print ' order error! usage python p.py opt(w or h) '
exit()
#opt(h : home or w : work)
opt=argv[1]
if(opt=='w'):
ip="135.32.89.239"
else:
ip="192.168.1.101"
authorizer = ftpserver.DummyAuthorizer()
#authorizer.add_user("sjw", "sjw123", "G:\\", perm="elradfmw")
authorizer.add_anonymous("G:\\")
handler = ftpserver.FTPHandler
handler.authorizer = authorizer
address = (ip, 21)
ftpd = ftpserver.FTPServer(address, handler)
ftpd.serve_forever()
if __name__ == "__main__":
main(sys.argv)
#=========================
run like this:
C:\>python ftp.py w
#=========error==========
Traceback (most recent call last):
File "C:\Python27\lib\asyncore.py", line 91, in write
obj.handle_write_event()
File "C:\Python27\lib\asyncore.py", line 463, in handle_write_event
self.handle_connect_event()
File "C:\Python27\lib\asyncore.py", line 448, in handle_connect_event
self.handle_connect()
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 858, in
handle_connect
handler = self.cmd_channel.dtp_handler(self.socket, self.cmd_channel)
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 944, in
__init__
self.close()
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 1137,
in close
asyncore.dispatcher.close(self)
File "C:\Python27\lib\asyncore.py", line 403, in close
self.socket.close()
File "C:\Python27\lib\asyncore.py", line 412, in __getattr__
retattr = getattr(self.socket, attr)
..................
File "C:\Python27\lib\asyncore.py", line 412, in __getattr__
retattr = getattr(self.socket, attr)
RuntimeError: maximum recursion depth exceeded
#==============================
with svn checkout pyftpdlib-read-only 901
#==============================
add this codes in my ftp.py , my ftp.py exit when error take place:
sys.setrecursionlimit(1000000)
Does this happen when the client connects?
Do you have the same problem if you use the 0.6.0 tarball instead of SVN
r901?
This error is like happened in the client were connected the server, the
transfer of data, I use the number of more connected to the client from the
server to download transmission movies and other large files.
I use the 0.6 version happened the error, and so to change from SVN
checkout the latest version test
At 2011-11-15 17:04:07,pyft...@googlecode.com wrote:
So you have the error with both 0.6.0 tarball and latest SVN revision?
Is that correct?
yes, the error with both 0.6.0 tarball and latest SVN revision
Thank you concern about this problem, my English is very poor, forgive me
^-^.
At 2011-11-15 17:36:46,pyft...@googlecode.com wrote:
Add the logs
Attachments:
ftpd.log 11.1 KB
ftpd.lines.log 77.5 KB
ftpd.error.log 244 KB
Can you attach a unique log file including log, lines and errors?
Add the unique log file including log, lines and errors
Attachments:
ftpd.unique.log 110 KB
Comment #8 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum
recursion depth exceeded
http://code.google.com/p/pyftpdlib/issues/detail?id=188
Please try r902 and tell me if it fixes the problem.
r903 should also fix this error I see in your logs:
[2011-11-16 11:43:31] Traceback (most recent call last):
File "C:\Python27\lib\asynchat.py", line 110, in handle_read
data = self.recv (self.ac_in_buffer_size)
File "C:\Python27\lib\asyncore.py", line 382, in recv
data = self.socket.recv(buffer_size)
error: [Errno 10035]
After testing, has solved "RuntimeError: maximum recursion depth exceeded"
error, but there the following four errors, please help us to see.thanks!
========================== 1 error =================================
[2011-11-17 11:07:19] Traceback (most recent call last):
File "C:\Python27\lib\asyncore.py", line 91, in write
obj.handle_write_event()
File "C:\Python27\lib\asyncore.py", line 463, in handle_write_event
self.handle_connect_event()
File "C:\Python27\lib\asyncore.py", line 448, in handle_connect_event
self.handle_connect()
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 860, in
handle_connect
self.cmd_channel._on_dtp_connection()
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 2321,
in _on_dtp_connection
if self._out_dtp_queue is not None:
File "C:\Python27\lib\asyncore.py", line 415, in __getattr__
%(self.__class__.__name__, attr))
AttributeError: FTPHandler instance has no attribute '_out_dtp_queue'
=========================== 2 error
============================================
[2011-11-17 11:11:18] Traceback (most recent call last):
File "C:\Python27\lib\asyncore.py", line 83, in read
obj.handle_read_event()
File "C:\Python27\lib\asyncore.py", line 442, in handle_read_event
self.handle_read()
File "C:\Python27\lib\asynchat.py", line 158, in handle_read
self.found_terminator()
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 2136,
in found_terminator
arg = self.fs.ftp2fs(arg or self.fs.cwd)
AttributeError: 'NoneType' object has no attribute 'ftp2fs'
=========================== 3 error
============================================
[2011-11-17 11:16:46] Traceback (most recent call last):
File "C:\Python27\lib\asyncore.py", line 83, in read
obj.handle_read_event()
File "C:\Python27\lib\asyncore.py", line 442, in handle_read_event
self.handle_read()
File "C:\Python27\lib\asynchat.py", line 158, in handle_read
self.found_terminator()
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 2168,
in found_terminator
self.process_command(cmd, arg, **kwargs)
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 2177,
in process_command
method(*args, **kwargs)
File "C:\Python27\lib\site-packages\pyftpdlib\ftpserver.py", line 2713,
in ftp_QUIT
if self.data_channel:
File "C:\Python27\lib\asyncore.py", line 415, in __getattr__
%(self.__class__.__name__, attr))
AttributeError: FTPHandler instance has no attribute 'data_channel'
=========================== 4 error
============================================
[2011-11-17 11:20:06] Traceback (most recent call last):
Added, the above is based on svn r903 version of the test case.
Can you also attach a complete log (log + logerror + logline) as you did
before?
I need a context to better understand what's going on.
Also, it would help immensely if you could provide a way to reproduce these
problems.
A step-to-step description, a script, anything.
Aattach the complete log (log + logerror + logline)
Ftp with pyftpdlib to improve services, through multi-threaded downloading
tool to download files when the error appeared in the log.
======== ftp.py =============
import sys
import os
import time
from pyftpdlib import ftpserver
now = lambda: time.strftime("[%Y-%m-%d %H:%M:%S]")
#f1 = open('ftpd.log', 'a')
#f2 = open('ftpd.lines.log', 'a')
#f3 = open('ftpd.error.log', 'a')
f = open('ftpd.unique.log', 'a')
def standard_logger(msg):
f.write("%s %s\n" %(now(), msg))
f.flush()
def line_logger(msg):
f.write("%s %s\n" %(now(), msg))
f.flush()
def error_logger(msg):
f.write("%s %s\n" %(now(), msg))
f.flush()
def main(argv):
ftpserver.log = standard_logger
ftpserver.logline = line_logger
ftpserver.logerror = error_logger
if(len(argv)!=2):
print ' order error! usage python p.py opt(w or h) '
exit()
#opt(h : home or w : work)
opt=argv[1]
if(opt=='w'):
ip="135.32.89.239"
else:
ip="192.168.1.101"
authorizer = ftpserver.DummyAuthorizer()
#authorizer.add_user("sjw", "sjw123", "G:\\", perm="elradfmw")
authorizer.add_anonymous("G:\\")
handler = ftpserver.FTPHandler
handler.authorizer = authorizer
address = (ip, 21)
ftpd = ftpserver.FTPServer(address, handler)
ftpd.serve_forever()
if __name__ == "__main__":
main(sys.argv)
==========================================
(based on svn r903 version of the test case.)
Attachments:
ftpd.unique.log 1.8 MB
I added some changes in r905 and r908.
Please try r908 and let me know how it goes.
As an extra: is it possible to see this thread-based script you're using?
I haven't been able to replicate any of your issues so far.
As always, a "ftpd.unique.log" file would be a lot better. =)
Aattach the complete log.
Attachments:
ftpd.unique_r908.log 2.3 MB
Please try r919.
The same errors,testing with r922."-"
Attachments:
ftpd.unique.r922.log 1.1 MB
Don't if this could help, but I'm trying to create an FTP Server in
windows, that catch all network interfaces and pass to pyftpdlib to listen.
The local client only can pass the username, after that it gets error.
Attachments:
ftpd.log 607 bytes