FTP Server busy waiting when file descriptors are exhausted

Thomas Rauscher trauscher at loytec.com
Thu Apr 6 09:45:42 UTC 2006



> -----Original Message-----
> From: Chris Johns [mailto:chrisj at rtems.org] 
> Sent: Tuesday, April 04, 2006 3:09 PM
> To: Thomas Rauscher
> Cc: rtems-users
> Subject: Re: FTP Server busy waiting when file descriptors 
> are exhausted
> 
> Thomas Rauscher wrote:
> > 
> > there has been little discussion so far. I still cannot see 
> a clean way 
> > to remove pending connections in the listen socket (besides 
> closing it).
> > 
> 
> I asked a question about the networking stack and the case of no 
> available fd's when in an accept call. I have found the code 
> for RTEMS 
> in cpukit/libnetworking/rtems/rtems_syscall.c:
> 
> 	fd = rtems_bsdnet_makeFdForSocket (so, &socket_handlers);
> 	if (fd < 0) {
> 		TAILQ_INSERT_HEAD(&head->so_comp, so, so_list);
> 		head->so_qlen++;
> 		soconnwakeup (head);
> 		rtems_bsdnet_semaphore_release ();
> 		return -1;
> 	}
> 
> If there is no fd available the socket is placed back on the 
> listen list.
> 
> Is this the best solution for RTEMS ?
> 
> I checked NetBSD's kernel and it will return an error from 
> accept if the 
> number of fd's for the process has reached its limit. A log 
> message is 
> generated. If there is no space the fd allocator blocks waiting. It 
> looks like FreeBSD is the same.
> 
> If you limit the number of fd's as task has (ulimit), use up 
> the fd's in 
> a similar way as the test case then try and accept a 
> connection the same 
> error will appear. How-ever on Unix the machine should not 
> have locked 
> up just the task.
> 
> Possible solutions are:
> 
> 1) The proposed patch.
> 2) Drop the connection if no fd is present (close the socket 
> placed on 
> the listen queue).
> 3) Block in the fd allocator (rtems_bsdnet_makeFdForSocket) 
> until an fd 
> appears. This could be for-ever or just a period of time.
> 4) Other suggestions.
> 


MfG,
Regards,
Thomas Rauscher

--
Thomas Rauscher
LOYTEC electronics GmbH
Stolzenthalergasse 24/3
A-1080 Wien
Austria/Europe
trauscher at loytec.com
www.loytec.com
Phone: +43-1-4020805-15
FAX:   +43-1-4020805-99

Networks under control!
LOYTEC and NEC Electronics Join Forces in Building Automation!
 
  



More information about the users mailing list