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

Control connection timeout causes 100% CPU usage #429

Open
johnstruse opened this Issue Jul 20, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@johnstruse

johnstruse commented Jul 20, 2017

We have been scanning our FTP servers with Nessus and frequently after a batch of scans have been run, the FTP server will be using 100% on Linux. An strace reveals that it is very rapidly attempting to poll one or more sockets (depending on how many are stuck).

epoll_wait(6, [{EPOLLOUT, {u32=25, u64=3426317835490557977}}], 1023, 100) = 1
read(25, 0x2802ba3, 5)                  = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(6, [{EPOLLOUT, {u32=25, u64=3426317835490557977}}], 1023, 100) = 1
read(25, 0x2802ba3, 5)                  = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(6, [{EPOLLOUT, {u32=25, u64=3426317835490557977}}], 1023, 100) = 1
read(25, 0x2802ba3, 5)   
# netstat -apn | grep 16458
tcp        0      0 127.0.0.1:21            0.0.0.0:*               LISTEN      16458/ftpd_linux.
tcp        0      0 xxx.xxx.xxx.xxx:21        0.0.0.0:*               LISTEN      16458/ftpd_linux.
tcp        0      0 xxx.xxx.xxx.xxx:21        yyy.yyy.yyy.yyy:38968   ESTABLISHED 16458/ftpd_linux.

In the FTPD logs, all other connections by yyy.yyy.yyy.yyy show that they were opened and closed successfully, however port 38968 shows an opened connection and then a timeout, but the socket never closed.

2017-07-15 17:26:02,840 pyftpdlib    INFO     yyy.yyy.yyy.yyy:38968-[] FTP session opened (connect)
2017-07-15 17:31:03,051 pyftpdlib    INFO     yyy.yyy.yyy.yyy:38968-[] Control connection timed out.

On yyy.yyy.yyy.yyy, a quick netstat shows that the socket is not open on that end any longer.

@giampaolo

This comment has been minimized.

Show comment
Hide comment
@giampaolo

giampaolo Oct 19, 2017

Owner

Sorry for the big delay in responding. Was there any progress about this? You can try running the server with DEBUG logging enabled:

    from pyftpdlib.log import config_logging
    config_logging(level=logging.DEBUG)

Hopefully that may give some hints about what syscall the busy loop keeps calling. It should be either send() or recv() failing with a certain error code.

Owner

giampaolo commented Oct 19, 2017

Sorry for the big delay in responding. Was there any progress about this? You can try running the server with DEBUG logging enabled:

    from pyftpdlib.log import config_logging
    config_logging(level=logging.DEBUG)

Hopefully that may give some hints about what syscall the busy loop keeps calling. It should be either send() or recv() failing with a certain error code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment