FTP Server busy waiting when file descriptors are exhausted

Chris Johns chrisj at rtems.org
Tue Mar 28 10:39:37 UTC 2006


Thomas Rauscher wrote:
> 
> You are right, a well designed application should not run into this
> situation.
> 

Ok.

> However, in my opinion the FTP server should handle this case more
> gracefully and not hang up exhausting the entire CPU time.

Sure causing a lock up is not nice.

> Currently, the
> problem that all fds are used triggers another problem that all lower
> priority threads are preempted by a not very productive thread.

Is this the case for just a single client connection ?

> 
> This is what I'm trying to address with my two proposed solution
> sketches.
> 

Ok.

> 1) Add a sleep() in the FTP server (less intrusive, but doesn't fix the
> problem)

It cannot fix a problem else where in the code but it would resolve the 
loading issue which may let other code run and recover.

> 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.

By control socket do you mean the listen socket ?

This is not a great solution.

I am curious what the networking stack is suppose to do with a 
connection that does not have an available fd. Should the connection be 
dropped ? Does anyone know what other operating system do ?

Regards
Chris



More information about the users mailing list