HPUX: number of open files

  • Follow


Hallo,

I was looking some time for a good way to debug file handle related
problems. Maybe somebody can help me with some questions I have
(regarding HP-UX 11.* IA64):

- for a running application (not shell) can I find out what the
process' soft and hard limits for number of files (and sockets I
guess) is?

- for a running application, can I actually read the number of used
handles? (I only know the work around with lsof -p, but I am not sure
how reliable I can get to the real count)

Besides that I wonder if a process reaches the soft limit or the
system wide nfile limit, is there a counter or log event I can monitor
for?

And finally, If I read the man pages right, the soft/hardlimit of a
login session is defined by the kernel tunables maxfiles and
maxfiles_lim and there is no project/group specific settings build
into HPUX (unlike PAM/limits.conf for Linux or Projects for Solaris)

Greetings
Bernd
--
http://itblog.eckenfels.net (german)
0
Reply bernd 11/10/2008 5:47:14 AM

bernd.eckenfels@googlemail.com wrote:
> - for a running application (not shell) can I find out what the
> process' soft and hard limits for number of files (and sockets I
> guess) is?


You can call getrlimit(2).  Use RLIMIT_NOFILE.

> - for a running application, can I actually read the number of used
> handles? (I only know the work around with lsof -p, but I am not sure
> how reliable I can get to the real count)


I suppose you could use pstat_getfile2(2) to get a list of the files.

> Besides that I wonder if a process reaches the soft limit or the
> system wide nfile limit, is there a counter or log event I can monitor
> for?


For nfile, you can use: kcusage nfile

> the soft/hardlimit of a
> login session is defined by the kernel tunables maxfiles and
> maxfiles_lim and there is no project/group specific settings built
> into HP-UX


Yes.  Unless ulimit -n (POSIX shell only) is used to set them smaller, 
either in /etc/profile or ~/.profile.
0
Reply Dennis 11/10/2008 9:24:15 PM


Hello Dennis,

thanks for your hints:

On 10 Nov., 22:24, Dennis Handly <dhan...@convex.hp.com> wrote:
> You can call getrlimit(2). =A0Use RLIMIT_NOFILE.

Yes, but I want to do that from outside the application. I think I can
get it to spawn a shell, so that would be the easiest. Just wondered
if one could remote attach an debugger or have some /proc/<pid> info
(like Linux).

> For nfile, you can use: kcusage nfile

Very good, found that. I guess with 11i it is dynamic/unlimited
usually anyway.

Greetings
Bernd

PS: why is ksh not supporting the NOFILE, isnt that one of the more
important resource limits?
0
Reply Bernd 11/11/2008 1:54:40 AM

bernd.eckenfels@googlemail.com wrote:
> Hallo,
> 
> I was looking some time for a good way to debug file handle related
> problems. Maybe somebody can help me with some questions I have
> (regarding HP-UX 11.* IA64):
> 
> - for a running application (not shell) can I find out what the
> process' soft and hard limits for number of files (and sockets I
> guess) is?
> 
> - for a running application, can I actually read the number of used
> handles? (I only know the work around with lsof -p, but I am not sure
> how reliable I can get to the real count)

Don't know for HP-UX. Solaris has pfiles.

> 
> Besides that I wonder if a process reaches the soft limit or the
> system wide nfile limit, is there a counter or log event I can monitor
> for?

syslog file, HP-UX normally has /var/adm/syslog/syslog.log

> 
> And finally, If I read the man pages right, the soft/hardlimit of a
> login session is defined by the kernel tunables maxfiles and
> maxfiles_lim and there is no project/group specific settings build
> into HPUX (unlike PAM/limits.conf for Linux or Projects for Solaris)
> 

These limits belong to the process environment, so Unix inheritance
takes place.
A shell spawned from your application is a child, and can give nothing
to its parent (only to its children).
But a shell wrapper like this will do it:

#!/bin/sh
ulimit -n 512
exec /path/to/application "$@"


-- 
echo imhcea\.lophc.tcs.hmo |
sed 's2\(....\)\(.\{5\}\)2\2\122;s1\(.\)\(.\)1\2\11g;1s;\.;::;2'
0
Reply Michael 11/11/2008 7:54:47 PM

Bernd Eckenfels wrote:
> but I want to do that from outside the application.

Do what?  Get the limit?  The limit is normally the same for everyone.
Get how many files currently open?  pstat_getfile2(2)

> if one could remote attach an debugger

I'm not sure what a debugger could tell you.

> PS: why is ksh not supporting the NOFILE, isn't that one of the more
> important resource limits?

No, I would expect the data size to be more important.  And ksh has 
always been johnny come lately with uname.
0
Reply Dennis 11/11/2008 10:48:46 PM

On 11 Nov., 23:48, Dennis Handly <dhan...@convex.hp.com> wrote:
> Bernd Eckenfels wrote:
> > but I want to do that from outside the application.
>
> Do what? =A0Get the limit? =A0The limit is normally the same for everyone=
..
> Get how many files currently open? =A0pstat_getfile2(2)

Yes, get the current soft limit and the list for a running process
(from externally). pstat_getfile2looks good, maybe pstat_getproc can
give me the limits (dont have access to the include file right now). I
would have preferred to have a command for that...

Greetings
Bernd
0
Reply Bernd 11/13/2008 1:47:46 AM

5 Replies
541 Views

(page loaded in 0.061 seconds)

Similiar Articles:













7/23/2012 3:45:35 PM


Reply: