Thread: Too Many Open Files... NetBSD

Too Many Open Files... NetBSD

From
"Ian Harding"
Date:
Argh.  I have finally come to the point where i have to pay attention to this nuts and bolts stuff.

I get:  ERROR:  pltcl: couldn't create pipe: too many open files

Is this the issue that requires setting options and recompiling my kernel like :

<Bruce's article>

FreeBSD
NetBSD
OpenBSD
The options SYSVSHM and SYSVSEM need to be enabled when the kernel is compiled. (They are by default.) The maximum size
ofshared memory is determined by the option SHMMAXPGS (in pages). The following shows an example of how to set the
variousparameters:  

options         SYSVSHM
options         SHMMAXPGS=4096
options         SHMSEG=256

options         SYSVSEM
options         SEMMNI=256
options         SEMMNS=512
options         SEMMNU=256
options         SEMMAP=256
(On NetBSD and OpenBSD the key word is actually option singular.)

</Bruce's article>

It seems there is no easy way to tweak kernel memory configuration stuff in NetBSD.  Can someone with some experience
inthis help me out here?  Thanks!! 

Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: iharding@tpchd.org


Re: Too Many Open Files... NetBSD

From
Bruce Momjian
Date:
> Argh.  I have finally come to the point where i have to pay attention to this nuts and bolts stuff.
>
> I get:  ERROR:  pltcl: couldn't create pipe: too many open files
>
> Is this the issue that requires setting options and recompiling my kernel like :
>
> <Bruce's article>
>
> FreeBSD
> NetBSD
> OpenBSD
> The options SYSVSHM and SYSVSEM need to be enabled when the kernel is compiled. (They are by default.) The maximum
sizeof shared memory is determined by the option SHMMAXPGS (in pages). The following shows an example of how to set the
variousparameters:  
>
> options         SYSVSHM
> options         SHMMAXPGS=4096
> options         SHMSEG=256
>
> options         SYSVSEM
> options         SEMMNI=256
> options         SEMMNS=512
> options         SEMMNU=256
> options         SEMMAP=256
> (On NetBSD and OpenBSD the key word is actually option singular.)
>
> </Bruce's article>
>
> It seems there is no easy way to tweak kernel memory configuration stuff in NetBSD.  Can someone with some experience
inthis help me out here?  Thanks!! 

OK, these are only for shared resources like system V shared memory and
semaphores.  Number of open files is controlled in a different way.

On my BSD/OS machine, sysctl allows you to control the maximum number of
open files.  The sysctl manual has:

     kern.maxfiles                          integer       yes

and the 'yes' indicates it can be changed via sysctl.  Perhaps NetBSD is
the same.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Too Many Open Files... NetBSD

From
Bruce Momjian
Date:
> Argh.  I have finally come to the point where i have to pay
> attention to this nuts and bolts stuff.
>
> I get:  ERROR:  pltcl: couldn't create pipe: too many open files
>
> Is this the issue that requires setting options and recompiling
> my kernel like :
>
> <Bruce's article>
>
> FreeBSD NetBSD OpenBSD The options SYSVSHM and SYSVSEM need to
> be enabled when the kernel is compiled. (They are by default.)
> The maximum size of shared memory is determined by the option
> SHMMAXPGS (in pages). The following shows an example of how to
> set the various parameters:

Did I write this?  I think this is from the official documentation,
though I do link to it from my hardware performance tuning article.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Too Many Open Files... NetBSD

From
Darren Ferguson
Date:
On Redhat is use the following

ulimit -SHc unlimited

Because i was receiving the same kind of problems

This cleared up the problem

Hope this helps

Darren

Darren Ferguson
Software Engineer
Openband

On Tue, 18 Dec 2001, Bruce Momjian wrote:

> > Argh.  I have finally come to the point where i have to pay attention to this nuts and bolts stuff.
> >
> > I get:  ERROR:  pltcl: couldn't create pipe: too many open files
> >
> > Is this the issue that requires setting options and recompiling my kernel like :
> >
> > <Bruce's article>
> >
> > FreeBSD
> > NetBSD
> > OpenBSD
> > The options SYSVSHM and SYSVSEM need to be enabled when the kernel is compiled. (They are by default.) The maximum
sizeof shared memory is determined by the option SHMMAXPGS (in pages). The following shows an example of how to set the
variousparameters:  
> >
> > options         SYSVSHM
> > options         SHMMAXPGS=4096
> > options         SHMSEG=256
> >
> > options         SYSVSEM
> > options         SEMMNI=256
> > options         SEMMNS=512
> > options         SEMMNU=256
> > options         SEMMAP=256
> > (On NetBSD and OpenBSD the key word is actually option singular.)
> >
> > </Bruce's article>
> >
> > It seems there is no easy way to tweak kernel memory configuration stuff in NetBSD.  Can someone with some
experiencein this help me out here?  Thanks!! 
>
> OK, these are only for shared resources like system V shared memory and
> semaphores.  Number of open files is controlled in a different way.
>
> On my BSD/OS machine, sysctl allows you to control the maximum number of
> open files.  The sysctl manual has:
>
>      kern.maxfiles                          integer       yes
>
> and the 'yes' indicates it can be changed via sysctl.  Perhaps NetBSD is
> the same.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


Re: Too Many Open Files... NetBSD

From
Tom Lane
Date:
"Ian Harding" <ianh@tpchd.org> writes:
> Argh.  I have finally come to the point where i have to pay attention to this nuts and bolts stuff.
> I get:  ERROR:  pltcl: couldn't create pipe: too many open files

My guess is that you are running into the fact that Postgres doesn't
allow a lot of headroom between the system's open-files-per-process
ulimit and the number of files it will open on its own account.  It
looks like the headroom is only 10 by default (see fd.c); and I think
stdin/stdout/stderr/client-socket etc are part of the 10.  So if you are
trying to execute something like system() that might open several more
files, you could easily hit the ulimit.

You will certainly want to increase the ulimit, but the trick remains
to keep Postgres from slurping it all for itself.  In 7.1 I think the
only way is to recompile with a larger RESERVE_FOR_LD value in fd.c.
In 7.2 there is a config variable that can be set to limit Postgres'
usage of file descriptors to something less than your ulimit value.

            regards, tom lane