Unix Programming - error : Too many open files

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > error : Too many open files





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author error : Too many open files
psnewsserver

2004-01-23, 4:56 pm

I am getting following error while calling shmat() on SOL 2.8

perror() of shmat : "Too many open files"

I added the following entries in the /etc/system file. It helped for
sometime, but after some period of time same problem is seen again.


#Addition in /etc/system ( adding shminfo_shmseg ,shminfo_shmmax value
... changing itto 2 times the default )

forceload: sys/shmsys
forceload: sys/semsys
set shmsys:shminfo_shmseg=12
set shmsys:shminfo_shmmax=2097152



even tried the following but no help
-------------------------------------

forceload: sys/shmsys
forceload: sys/semsys
set shmsys:shminfo_shmmax=268435456
set shmsys:shminfo_shmmin=100
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=100


%ulimit -n
256

Any suggestion will be appreciated.

Thanks
Paras


Rich Teer

2004-01-23, 4:56 pm

On Tue, 18 Nov 2003, psnewsserver wrote:
quote:

> I am getting following error while calling shmat() on SOL 2.8



That's Solaris 8, not 2.8.
quote:

> perror() of shmat : "Too many open files"
>
> I added the following entries in the /etc/system file. It helped for
> sometime, but after some period of time same problem is seen again.



It looks like your problem is lack of file descriptors, not
lack of System V IPC resources. Use ulimit to increase the
maximum number of file descriptors, and you should be OK.

HTH,

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
Rich Teer

2004-01-23, 4:56 pm

On Tue, 18 Nov 2003, psnewsserver wrote:
quote:

> I am getting following error while calling shmat() on SOL 2.8



That's Solaris 8, not 2.8.
quote:

> perror() of shmat : "Too many open files"
>
> I added the following entries in the /etc/system file. It helped for
> sometime, but after some period of time same problem is seen again.



It looks like your problem is lack of file descriptors, not
lack of System V IPC resources. Use ulimit to increase the
maximum number of file descriptors, and you should be OK.

HTH,

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
Andrei Voropaev

2004-01-23, 4:56 pm

On 2003-11-18, Rich Teer <rich.teer@rite-group.com> wrote:
quote:

> On Tue, 18 Nov 2003, psnewsserver wrote:
>
>
> That's Solaris 8, not 2.8.
>
>
> It looks like your problem is lack of file descriptors, not
> lack of System V IPC resources. Use ulimit to increase the
> maximum number of file descriptors, and you should be OK.



Also check why you don't have enough file descriptors. Maybe you forget
to close them somewhere?

Andrei
Andrei Voropaev

2004-01-23, 4:56 pm

On 2003-11-18, Rich Teer <rich.teer@rite-group.com> wrote:
quote:

> On Tue, 18 Nov 2003, psnewsserver wrote:
>
>
> That's Solaris 8, not 2.8.
>
>
> It looks like your problem is lack of file descriptors, not
> lack of System V IPC resources. Use ulimit to increase the
> maximum number of file descriptors, and you should be OK.



Also check why you don't have enough file descriptors. Maybe you forget
to close them somewhere?

Andrei
martyn

2004-01-23, 4:56 pm

> It looks like your problem is lack of file descriptors, not
quote:

> lack of System V IPC resources. Use ulimit to increase the
> maximum number of file descriptors, and you should be OK.
>
> HTH,



If ulimit doesn't do it, try adding following to /etc/system

set rlim_fd_max = 8192
set rlim_fd_cur = 8192 (or 1024 which may be better)
martyn

2004-01-23, 4:56 pm

> It looks like your problem is lack of file descriptors, not
quote:

> lack of System V IPC resources. Use ulimit to increase the
> maximum number of file descriptors, and you should be OK.
>
> HTH,



If ulimit doesn't do it, try adding following to /etc/system

set rlim_fd_max = 8192
set rlim_fd_cur = 8192 (or 1024 which may be better)
Juha Laiho

2004-01-23, 4:56 pm

"psnewsserver" <psnewsserver@netscape.net> said:
quote:

>I am getting following error while calling shmat() on SOL 2.8
>
> perror() of shmat : "Too many open files"
>
>I added the following entries in the /etc/system file. It helped for
>sometime, but after some period of time same problem is seen again.



Is your application perhaps leaking semaphores - i.e. creating them,
but not releasing them on exit? SysV IPC resources are not deallocated
on process exit - they're only cleaned up explicitly by the application,
or by system reboot (or manually by administrator).

"ipcs -a" command should help you identify this situation. Run this after
a reboot, then periodically while running your application, and also
at the time when you get the error.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Juha Laiho

2004-01-23, 4:56 pm

"psnewsserver" <psnewsserver@netscape.net> said:
quote:

>I am getting following error while calling shmat() on SOL 2.8
>
> perror() of shmat : "Too many open files"
>
>I added the following entries in the /etc/system file. It helped for
>sometime, but after some period of time same problem is seen again.



Is your application perhaps leaking semaphores - i.e. creating them,
but not releasing them on exit? SysV IPC resources are not deallocated
on process exit - they're only cleaned up explicitly by the application,
or by system reboot (or manually by administrator).

"ipcs -a" command should help you identify this situation. Run this after
a reboot, then periodically while running your application, and also
at the time when you get the error.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Brad

2004-01-23, 4:56 pm


"Rich Teer" <rich.teer@rite-group.com> wrote in message
news:Pine.SOL.4.58.0311172213460.29152@zaphod...
quote:

> On Tue, 18 Nov 2003, psnewsserver wrote:
>
>
> That's Solaris 8, not 2.8.
>
>
> It looks like your problem is lack of file descriptors, not
> lack of System V IPC resources. Use ulimit to increase the
> maximum number of file descriptors, and you should be OK.
>


Question? Do you really need to have >256 files open at one time? Are you
failing to close them when you are done with them? Few apps would need that
many files open at one time.
quote:

> HTH,
>
> --
> Rich Teer, SCNA, SCSA
>
> President,
> Rite Online Inc.
>
> Voice: +1 (250) 979-1638
> URL: http://www.rite-online.net



Brad



Brad

2004-01-23, 4:56 pm


"Rich Teer" <rich.teer@rite-group.com> wrote in message
news:Pine.SOL.4.58.0311172213460.29152@zaphod...
quote:

> On Tue, 18 Nov 2003, psnewsserver wrote:
>
>
> That's Solaris 8, not 2.8.
>
>
> It looks like your problem is lack of file descriptors, not
> lack of System V IPC resources. Use ulimit to increase the
> maximum number of file descriptors, and you should be OK.
>


Question? Do you really need to have >256 files open at one time? Are you
failing to close them when you are done with them? Few apps would need that
many files open at one time.
quote:

> HTH,
>
> --
> Rich Teer, SCNA, SCSA
>
> President,
> Rite Online Inc.
>
> Voice: +1 (250) 979-1638
> URL: http://www.rite-online.net



Brad



Michael Kerrisk

2004-01-23, 4:57 pm

On Tue, 18 Nov 2003 06:16:07 GMT, Rich Teer <rich.teer@rite-group.com>
wrote:
quote:

>On Tue, 18 Nov 2003, psnewsserver wrote:
>
>
>That's Solaris 8, not 2.8.
>
>
>It looks like your problem is lack of file descriptors, not
>lack of System V IPC resources. Use ulimit to increase the
>maximum number of file descriptors, and you should be OK.



Rather, the problem seems more likely to be this (from shmat(2)):

EMFILE
The number of shared memory segments attached to the
calling process would exceed the system-imposed limit.

As suggested by another poster, the problem is probably an IPC
resource leak. The OP should try looking at the system using ipcs(8)
to see if there are undeleted shared memory segments on the system,
and if so, fix the application.

Cheers,

Michael
Michael Kerrisk

2004-01-23, 4:57 pm

On Tue, 18 Nov 2003 06:16:07 GMT, Rich Teer <rich.teer@rite-group.com>
wrote:
quote:

>On Tue, 18 Nov 2003, psnewsserver wrote:
>
>
>That's Solaris 8, not 2.8.
>
>
>It looks like your problem is lack of file descriptors, not
>lack of System V IPC resources. Use ulimit to increase the
>maximum number of file descriptors, and you should be OK.



Rather, the problem seems more likely to be this (from shmat(2)):

EMFILE
The number of shared memory segments attached to the
calling process would exceed the system-imposed limit.

As suggested by another poster, the problem is probably an IPC
resource leak. The OP should try looking at the system using ipcs(8)
to see if there are undeleted shared memory segments on the system,
and if so, fix the application.

Cheers,

Michael
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com