FTP Server busy waiting when file descriptors are exhausted

Thomas Rauscher trauscher at loytec.com
Mon Mar 27 13:37:07 UTC 2006


Hi,

we've found a bug in the RTEMS FTP server and would like to develop a
patch.

The problem is also described in PR930.

If the FTP server is running (control socket already open), and all FDs
are 
used and a new data connection is started, the FTP server ends up in a 
loop in its daemon() function. This loop continues until there are FDs
available
again. This results in 100% CPU usage and the FTP server prints 

syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
syslog: ftpd: Error accepting control connection: Too many open files in
system
....

The problem is that there is no way to remove the connection request in
the control
socket (besides closing it and reopening it).

There are two appearent fixes:

1) Add a sleep() in the FTP server (less intrusive, but doesn't fix the
problem)
2) Close control socket and open again. However, what should happens if
the control
   socket cannot be reopened? This would be even worse. AFAIK, there is
no flush
   function for listening sockets.

I would like to start some discussion which solution is preferable or if
there are
different ones. The best answer anyway would be, that it is possible to 
flush a listening socket without closing it ...

Regards,
Thomas Rauscher

--
Thomas Rauscher
LOYTEC electronics GmbH




More information about the users mailing list