Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: maximum recursion depth exceeded #188

Open
giampaolo opened this issue May 28, 2014 · 22 comments
Open

RuntimeError: maximum recursion depth exceeded #188

giampaolo opened this issue May 28, 2014 · 22 comments
Labels
bug Component-Library imported imported from old googlecode site and very likely outdated Priority-High

Comments

@giampaolo
Copy link
Owner

From sjwhi8...@gmail.com on November 15, 2011 09:30:39

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)

Original issue: http://code.google.com/p/pyftpdlib/issues/detail?id=188

@giampaolo
Copy link
Owner Author

From g.rodola on November 15, 2011 01:03:37

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 ?

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 15, 2011 01:33:02

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,pyftpdlib@googlecode.com wrote:

@giampaolo
Copy link
Owner Author

From g.rodola on November 15, 2011 01:36:20

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

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 15, 2011 01:43:03

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,pyftpdlib@googlecode.com wrote:

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 15, 2011 01:48:51

Add the logs

Attachment: ftpd.log ftpd.lines.log ftpd.error.log

@giampaolo
Copy link
Owner Author

From g.rodola on November 15, 2011 02:28:28

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

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 16, 2011 00:25:05

Add the unique log file including log, lines and errors

Attachment: ftpd.unique.log

@giampaolo
Copy link
Owner Author

From g.rodola on November 16, 2011 11:50:39

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

Labels: -Priority-Medium Priority-High

@giampaolo
Copy link
Owner Author

From g.rodola on November 16, 2011 12:08:53

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]

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 17, 2011 01:21:28

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

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 17, 2011 01:29:28

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

@giampaolo
Copy link
Owner Author

From g.rodola on November 17, 2011 08:58:43

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.

@giampaolo
Copy link
Owner Author

From g.rodola on November 17, 2011 09:01:27

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

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 17, 2011 18:49:39

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

Attachment: ftpd.unique.log

@giampaolo
Copy link
Owner Author

From g.rodola on November 19, 2011 10:19:06

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.

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 20, 2011 19:45:05

Tests with r908 , still has the following two errors appear in the log.
In addition, multi-threaded downloading tool is not to write my own script, it 
is a download software program, in 
http://dl_dir.qq.com/invc/cyclone/QQDownload_Setup_38_702.exe download and 
install, then you can operate inside the screenshot to reproduce the error.
=================== 1 error ===============================
 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 2165, in 
found_terminator
    arg = self.fs.ftp2fs(arg or self.fs.cwd)
AttributeError: 'NoneType' object has no attribute 'ftp2fs'

========================== 2 error ======================================
[2011-11-20 11:40:17] 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]

Attachment: operating like this.doc

@giampaolo
Copy link
Owner Author

From g.rodola on November 23, 2011 13:49:06

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

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 24, 2011 00:13:56

Aattach the complete log.

Attachment: ftpd.unique_r908.log

@giampaolo
Copy link
Owner Author

From g.rodola on November 26, 2011 10:22:43

Please try r919 .

@giampaolo
Copy link
Owner Author

From sjwhi8...@gmail.com on November 28, 2011 03:47:51

The same errors,testing with r922 ."-"

Attachment: ftpd.unique.r922.log

@giampaolo
Copy link
Owner Author

From raf...@zamana.eti.br on February 10, 2012 16:55:40

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.

Attachment: ftpd.log

@milind00
Copy link

Is this issue resolved? I am facing same issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component-Library imported imported from old googlecode site and very likely outdated Priority-High
Projects
None yet
Development

No branches or pull requests

2 participants