Recently, I used pyftpdlib to develop a ftp server program, which helps me to greatly reduce the development cycle. However, at the same time, I also found a bug that it would cause the zombie process after login and exit every time. Here, I use the MultiprocessFTPServer to instantiate a server object.
My source code is as follows:
...
if masquerade_address is not None:
handler.masquerade_address = masquerade_address
handler.passive_ports = passive_ports
server = MultiprocessFTPServer(("0.0.0.0", port), handler)
try:
server.serve_forever()
finally:
server.close_all()
...
I found that the pyftpdlib always create a new process to handle a new connection each time and it does not wait for these processes whenever the connection is broken. Only when the server process exits, does it wait for all the sub processes in a unified way.
The following is some screenshots on the bug:
login operationuse 'ps' command
I think using a thread to periodically wait for all the tasks might be a good solution.
Submitted code has been carefully tested and can prove to be effective.
In addition, I also found that the maximum number of connections seems to not work for MultiprocessFTPServer.
Recently, I used pyftpdlib to develop a ftp server program, which helps me to greatly reduce the development cycle. However, at the same time, I also found a bug that it would cause the zombie process after login and exit every time. Here, I use the MultiprocessFTPServer to instantiate a server object. My source code is as follows:
I found that the pyftpdlib always create a new process to handle a new connection each time and it does not wait for these processes whenever the connection is broken. Only when the server process exits, does it wait for all the sub processes in a unified way. The following is some screenshots on the bug: login operation use 'ps' command
I think using a thread to periodically wait for all the tasks might be a good solution. Submitted code has been carefully tested and can prove to be effective.
In addition, I also found that the maximum number of connections seems to not work for MultiprocessFTPServer.