open file descriptors

From: santoshjoseph73 (member45873_at_dbforums.com)
Date: 10/27/03


Date: Mon, 27 Oct 2003 14:35:17 -0500


I think this question has been posted before, but I don't think the
answers were clear.

The problem I have is I'm running a server on unix(solairs 2.7) and i'm
running out of sockets. I use the setulimit function like this

      new_res.rlim_cur = res.rlim_max;

      new_res.rlim_max = res.rlim_max;

      if ( -1 == setrlimit(RLIMIT_NOFILE, &new_res) )

         return 0;

and this sets the open file descriptor limit to 1024. The question what
should I do when I get a socket error on a accept and the error is
EMFILE (Too many open files).

Should I sleep for a bit (1 second) and retry the accept? But what
happened the connection that was being tried did it fail (so the client
would get an error?)

And how can I avoid this type of situation? Can I find out how many
open file descriptors are currently being used (in code) so I avoid
accepting new connections?

How do Unix web servers solve this problem?

Thanks,

-Santosh

--
Posted via http://dbforums.com


Relevant Pages

  • Re: OE6 cannot connect to mail server after login change
    ... The connection to the server has failed. ... Account: 'mail.labyrinth.net.au', Server: 'mail.labyrinth.net.au', Protocol: POP3, Port: 110, Secure: No, Socket Error: 10061, Error Number: 0x800CCC0E ... When the mail connection does work, changing Nortons makes no difference also. ... My other settings aren't anything special as far as I can tell, POP3, the right ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: cannot recieve email.
    ... > The connection to the server has failed. ... > Protocol: POP3, Port: 110, Secure: No, Socket Error: ...
    (microsoft.public.outlook.general)
  • I also cant send email...
    ... "The connection to the server has failed. ... Account: 'pop3.email.msn.com', ... Socket Error: 10051, Error Number: 0x800CCC0E". ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Windows server 2003 randomly failing
    ... Shared Folders> Open Files, the user only has 1 or 2 files open. ... All clients and the server ... Ethernet adapter Local Area Connection: ... as an ERP, financial apps, etc? ...
    (microsoft.public.windows.server.general)
  • Re: outlook express 6
    ... connection to the server has failed. ... Account: 'mail.comcast.net', Server: 'mail.comcast.net', Protocol: POP3, Port: 110, Secure: No, Socket Error: 10061, Error Number: 0x800CCC0E" ... If I wait awhile,5 to 120 minutes,I may get connected.The isp says it is a Microsoft problem.I tend to agree since the message comes up so fast and doesn't give chance for connection. ...
    (microsoft.public.windowsxp.help_and_support)