Issue 188 in pyftpdlib: RuntimeError: maximum recursion depth exceeded

18 views
Skip to first unread message

pyft...@googlecode.com

unread,
Nov 15, 2011, 3:31:28 AM11/15/11
to pyftpdli...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Component-Library

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)

pyft...@googlecode.com

unread,
Nov 15, 2011, 4:04:07 AM11/15/11
to pyftpdli...@googlegroups.com

Comment #1 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

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?

pyft...@googlecode.com

unread,
Nov 15, 2011, 4:33:45 AM11/15/11
to pyftpdli...@googlegroups.com

Comment #2 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

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:

pyft...@googlecode.com

unread,
Nov 15, 2011, 4:37:48 AM11/15/11
to pyftpdli...@googlegroups.com

Comment #3 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

So you have the error with both 0.6.0 tarball and latest SVN revision?
Is that correct?

pyft...@googlecode.com

unread,
Nov 15, 2011, 4:44:05 AM11/15/11
to pyftpdli...@googlegroups.com

Comment #4 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

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:

pyft...@googlecode.com

unread,
Nov 15, 2011, 4:49:07 AM11/15/11
to pyftpdli...@googlegroups.com

Comment #5 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

Add the logs

Attachments:
ftpd.log 11.1 KB
ftpd.lines.log 77.5 KB
ftpd.error.log 244 KB

pyft...@googlecode.com

unread,
Nov 15, 2011, 5:28:53 AM11/15/11
to pyftpdli...@googlegroups.com

Comment #6 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

Can you attach a unique log file including log, lines and errors?


pyft...@googlecode.com

unread,
Nov 16, 2011, 3:25:44 AM11/16/11
to pyftpdli...@googlegroups.com

Comment #7 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

Add the unique log file including log, lines and errors

Attachments:
ftpd.unique.log 110 KB

pyft...@googlecode.com

unread,
Nov 16, 2011, 2:51:14 PM11/16/11
to pyftpdli...@googlegroups.com
Updates:
Labels: -Priority-Medium Priority-High

Comment #8 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

Please try r902 and tell me if it fixes the problem.

pyft...@googlecode.com

unread,
Nov 16, 2011, 3:08:57 PM11/16/11
to pyftpdli...@googlegroups.com

Comment #9 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

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]

pyft...@googlecode.com

unread,
Nov 17, 2011, 4:22:19 AM11/17/11
to pyftpdli...@googlegroups.com

Comment #10 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

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):

pyft...@googlecode.com

unread,
Nov 17, 2011, 4:30:25 AM11/17/11
to pyftpdli...@googlegroups.com

Comment #11 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

Added, the above is based on svn r903 version of the test case.

pyft...@googlecode.com

unread,
Nov 17, 2011, 11:58:49 AM11/17/11
to pyftpdli...@googlegroups.com

Comment #12 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

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.

pyft...@googlecode.com

unread,
Nov 17, 2011, 12:02:50 PM11/17/11
to pyftpdli...@googlegroups.com

Comment #13 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

Also, it would help immensely if you could provide a way to reproduce these
problems.
A step-to-step description, a script, anything.

pyft...@googlecode.com

unread,
Nov 17, 2011, 9:51:35 PM11/17/11
to pyftpdli...@googlegroups.com

Comment #14 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

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

pyft...@googlecode.com

unread,
Nov 19, 2011, 1:19:46 PM11/19/11
to pyftpdli...@googlegroups.com

Comment #15 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

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.

pyft...@googlecode.com

unread,
Nov 23, 2011, 4:50:06 PM11/23/11
to pyftpdli...@googlegroups.com

Comment #17 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

As always, a "ftpd.unique.log" file would be a lot better. =)

pyft...@googlecode.com

unread,
Nov 24, 2011, 3:14:34 AM11/24/11
to pyftpdli...@googlegroups.com

Comment #18 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

Aattach the complete log.

Attachments:
ftpd.unique_r908.log 2.3 MB

pyft...@googlecode.com

unread,
Nov 26, 2011, 1:22:53 PM11/26/11
to pyftpdli...@googlegroups.com

Comment #19 on issue 188 by g.rod...@gmail.com: RuntimeError: maximum

Please try r919.

pyft...@googlecode.com

unread,
Nov 28, 2011, 6:48:37 AM11/28/11
to pyftpdli...@googlegroups.com

Comment #20 on issue 188 by sjwhi8...@gmail.com: RuntimeError: maximum

The same errors,testing with r922."-"

Attachments:
ftpd.unique.r922.log 1.1 MB

pyft...@googlecode.com

unread,
Feb 10, 2012, 7:55:51 PM2/10/12
to pyftpdli...@googlegroups.com

Comment #21 on issue 188 by raf...@zamana.eti.br: RuntimeError: maximum

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

Reply all
Reply to author
Forward
0 new messages