dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

HPUX: number of open files - hp-hpux

This is a discussion on HPUX: number of open files - hp-hpux ; 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 ...


Home > Database Forum > Operating Systems > hp-hpux > HPUX: number of open files

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 11-10-2008, 01:47 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default HPUX: number of open files

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)
Reply With Quote
  #2  
Old 11-10-2008, 05:24 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: HPUX: number of open files

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.
Reply With Quote
  #3  
Old 11-10-2008, 09:54 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: HPUX: number of open files

Hello Dennis,

thanks for your hints:

On 10 Nov., 22:24, Dennis Handly wrote:
> You can call getrlimit(2). *Use 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/ 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?
Reply With Quote
  #4  
Old 11-11-2008, 03:54 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: HPUX: number of open files

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;1 s;\.;::;2'
Reply With Quote
  #5  
Old 11-11-2008, 06:48 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: HPUX: number of open files

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.
Reply With Quote
  #6  
Old 11-12-2008, 09:47 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: HPUX: number of open files

On 11 Nov., 23:48, Dennis Handly wrote:
> 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)


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
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 03:24 AM.