giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.65k stars 267 forks source link

Flooding errors: 'FTPHandler' object has no attribute 'data_channel' #508

Open Fak3 opened 4 years ago

Fak3 commented 4 years ago

os: CentOS Linux release 7.4.1708 kernel: 3.10.0-693.el7.x86_64 python: 3.6 pyftpdlib version: 1.5.4

My config:

from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler, ThrottledDTPHandler
from pyftpdlib.servers import MultiprocessFTPServer

authorizer = DummyAuthorizer()
authorizer.add_anonymous('/mnt/ftpnp')

dtp_handler = ThrottledDTPHandler
dtp_handler.read_limit = 1_000_000 
dtp_handler.write_limit = 1_000_000  

handler = FTPHandler
handler.authorizer = authorizer
handler.dtp_handler = dtp_handler
handler.passive_ports = range(53000, 54000)

address = ('', 21)
server = MultiprocessFTPServer(address, handler, backlog=50)
server.max_cons = 1024
server.max_cons_per_ip = 54
server.serve_forever()
ERROR 2019-09-26 16:31:02,266 pyftpdlib: unhandled exception in instance <FTPHandler(id=140463009221264, addr='212.232.79.193:56646', user='anonymous')>
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncore.py", line 83, in read
    obj.handle_read_event()
  File "/usr/lib64/python3.6/asyncore.py", line 423, in handle_read_event
    self.handle_read()
  File "/usr/local/lib/python3.6/site-packages/pyftpdlib/ioloop.py", line 920, in handle_read
    asynchat.async_chat.handle_read(self)
  File "/usr/lib64/python3.6/asynchat.py", line 171, in handle_read
    self.found_terminator()
  File "/usr/local/lib/python3.6/site-packages/pyftpdlib/handlers.py", line 1414, in found_terminator
    self.pre_process_command(line, cmd, arg)
  File "/usr/local/lib/python3.6/site-packages/pyftpdlib/handlers.py", line 1531, in pre_process_command
    self.process_command(cmd, arg, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pyftpdlib/handlers.py", line 1542, in process_command
    method(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pyftpdlib/handlers.py", line 2282, in ftp_RETR
    self.push_dtp_data(producer, isproducer=True, file=fd, cmd="RETR")
  File "/usr/local/lib/python3.6/site-packages/pyftpdlib/handlers.py", line 1754, in push_dtp_data
    self.data_channel.file_obj = file
AttributeError: 'FTPHandler' object has no attribute 'data_channel'