FTP Server busy waiting when file descriptors are exhausted

Thomas Doerfler Thomas.Doerfler at imd-systems.de
Mon Mar 27 14:15:45 UTC 2006


Thomas,

just an idea: whould it be possible to already open/reserve a data FD, 
when a control connection is to be accepted? Then it would make sense to 
  reject the control connection in case no fd for the data socket is 
available.

wkr,
Thomas.

Thomas Rauscher wrote:
> 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
> 


-- 
--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available at:
      http://www.imd-systems.de/pgpkey_en.html



More information about the users mailing list