linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bryan Christ <bryan.christ@gmail.com>
To: Glynn Clements <glynn@gclements.plus.com>
Cc: Joe Damato <ice799@gmail.com>, linux-c-programming@vger.kernel.org
Subject: Re: running out of file descriptors
Date: Mon, 16 Feb 2009 11:39:28 -0600	[thread overview]
Message-ID: <444391460902160939x639e2289gc8fbe7cd75f6ee0f@mail.gmail.com> (raw)
In-Reply-To: <18841.25815.270749.45139@cerise.gclements.plus.com>

Yes--the daemon runs as root.  It believe it's running out of file
descriptors because as soon as I hit that magic 700 number, the
daemons fail to stop accepting connections and all of the transfer
threads start aborting with EPIPE.  My only other thought is perhaps I
am somehow hitting a limit on the number of open sockets I can have...
but as far as I know that is the same as the number of max open file
descriptors.

On Mon, Feb 16, 2009 at 7:06 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:
>
> Bryan Christ wrote:
>
>> >> I am writing a multi-threaded application which services hundreds of
>> >> remote connections for data transfer.  Several instances of this
>> >> program are run simultaneously.  The problem is that whenever the
>> >> total number of active user connections (cumulative total of all open
>> >> sockets tallied from all process instances) reaches about 700 the
>> >> system appears to run out of file descriptors.  I have tried raising
>> >> the open files limit via "ulimit -n" and by using the setrlimit()
>> >> facility.  Neither of these seem to help.  I am currently having to
>> >> limit the number of processes running on the system to 2 instances
>> >> allowing no more than 256 connections each.
>> >
>> > Have you tried editing /etc/security/limits.conf  (or equivalent file
>> > on your system) to increase the max number of open files?
>>
>> It seems that would be the same as setting RLIMIT_NOFILE via
>> setrlimt() or the same as using the userspace tool "ulimit -n".  Am I
>> wrong?  Isn't this the same?
>
> Is your daemon running as root? If not, it cannot increase any hard
> resource limit. Are you checking the return value (and errno) from
> setrlimit()?
>
> BTW, what do you mean by "appears to run out of file descriptors"?
> Which system call fails, and with what error?
>
> --
> Glynn Clements <glynn@gclements.plus.com>
>



-- 
Bryan
<><

      reply	other threads:[~2009-02-16 17:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16  5:48 running out of file descriptors Bryan Christ
2009-02-16  6:18 ` Joe Damato
2009-02-16  7:09   ` Bryan Christ
2009-02-16 13:01     ` Eric Bambach
2009-02-16 17:35       ` Bryan Christ
2009-02-16 21:43         ` Glynn Clements
2009-02-17 18:51           ` Bryan Christ
2009-02-18  7:07             ` Holger Kiehl
2009-02-16 13:06     ` Glynn Clements
2009-02-16 17:39       ` Bryan Christ [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=444391460902160939x639e2289gc8fbe7cd75f6ee0f@mail.gmail.com \
    --to=bryan.christ@gmail.com \
    --cc=glynn@gclements.plus.com \
    --cc=ice799@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).