File Descriptors

Posted on 2000-01-24
Medium Priority
Last Modified: 2013-12-26
Hi !

Can a Unix system ever run out of file descriptors ?
Reason for asking is that we have an application that relies heavily on sockets.  We have a SQL server running with 500 connections, a communications application that we have written that if all connections are used would use over 700 file descriptors.  Our client's to connect are threaded with at least 3 connections to the sql server and 3 connections to the comms program.  We seem to get a problem with opening file's and accepting sockets, in various applications we run.  We are just wondering if we have hit any of our system's limits.  We are running a Sun E4500 with 1Gig memory and 4 x 400Mhz with Solaris 2.6.

I would be greatful for any advice.


Question by:checkin
  • 2
  • 2
LVL 20

Expert Comment

ID: 2382203
It used to be true that a program could run out of file descriptors in two ways on UNIX. The per-process limit on file descriptors was originally 20. In systems I'm familiar with, the per-process limit ranges between 64 and 4096, but some variant may have increased that to 64K or larger. The other way a process could be unable to open a file would be because the system-wide open file table was full. I think modern variants of UNIX allocated these dynamically, so you can have as many open files across the system as you have kernel VM to allocate them.

Do you know what value of  errno is associated with the problems you are having opening files and accepting sockets?

I can't say anything definite about Solaris 2.6, though. There's enough experts around here, though, that I expect one will be along soon with an answer for you.


Accepted Solution

sereda earned 400 total points
ID: 2386190
The answer is YES, surely unix (solaris 2.6 namely) can run out of file descriptors.
You can tune your kernel for heavily loaded system by editing /etc/system file and putting following lines there:

* Softlimit of open files you can have for one process (default = 64)
set rlim_fd_cur = 4096

* Hardlimit of open files you can have for total (default = 1024)
set rlim_fd_max = 8192

There are also many other useful things you can tune there.

You need to restart system for changes in /etc/system to take effect.


Author Comment

ID: 2388008
You mention there are many other ways to tune the system using /etc/system. Where can I find this information ?


Expert Comment

ID: 2388424
look at
   man -s 4 system

and at the sun www site (or sun developers site, i don't remember it's URL)

If you need something concrete, ask.

Author Comment

ID: 2389294
thanks !

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

599 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question