Advertisement

05.03.2007 at 11:08AM PDT, ID: 22551088
[x]
Attachment Details

How to monitor open file handles in a process

Asked by nswartz in HP-UX Unix, Unix Operating Systems

Tags: file, open, handles, process, monitor

We have a process that is running out of file handles. We are trying to address this problem with the vendor, but in the meantime we need to bounce it when it is getting near the limit. Currently we use Glance to see how many are in use. Is there some command line way to determine this that we can include into a cron script?Start Free Trial
 
Loading Advertisement...
 
[+][-]05.03.2007 at 11:56AM PDT, ID: 19025815

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.03.2007 at 01:56PM PDT, ID: 19026855

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.03.2007 at 05:39PM PDT, ID: 19028121

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.04.2007 at 11:05AM PDT, ID: 19032800

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.04.2007 at 11:06AM PDT, ID: 19032811

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2007 at 04:18AM PDT, ID: 19048858

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2007 at 04:44AM PDT, ID: 19048962

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2007 at 04:00AM PDT, ID: 19080781

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2007 at 04:35PM PDT, ID: 19112628

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.20.2007 at 01:53PM PDT, ID: 19124032

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: HP-UX Unix, Unix Operating Systems
Tags: file, open, handles, process, monitor
Sign Up Now!
Solution Provided By: Vee_Mod
Participating Experts: 3
Solution Grade: B
 
 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.03.2007 at 11:56AM PDT, ID: 19025815
You could run Glance in background and redirect the output to a file, which could then be parsed for the info you need:
http://unix.derkeiler.com/Mailing-Lists/HP-UX-Admin/2003-05/0035.html
The problem would be with selecting/interpreting/formatting the data from the output file.

If you just want to check when the _system_ is running out of file handles, `sar -v` may be good enough for your needs
 
05.03.2007 at 01:56PM PDT, ID: 19026855
OK, that seems to work. I still need to figure out how to get the number of file handles for a specific process. The settings in that article provide the load average per cpu.
 
05.03.2007 at 05:39PM PDT, ID: 19028121
I _did_ say selection would be a problem ;-)

I don't have an HP-UX system with Glance, but if you can select a single process (-s Process_ID ?)  or list all open files for processes (-F ?)  from the command line and post the output, then (we) can help in interpreting the output using a script.

 
05.04.2007 at 11:05AM PDT, ID: 19032800
I found a better answer: If I use lsof -p <PID> it shows all the open files/sockets. I pipe into wc and it tells me the number of open file handles.
Thanks for the suggestions on glance. I think I can use that for other tasks.
tfewster: I will still give you the points for the good direction to research.
 
05.04.2007 at 11:06AM PDT, ID: 19032811
Also, glance has example scripts in /opt/perf/examples/adviser including a file handle monitor
 
05.08.2007 at 04:18AM PDT, ID: 19048858

Note that you can limit the number of file descriptors that a process can open, using the built-in unix command 'ulimit':

   ulimit -n 12       # will limit the number of *available* file descriptors to 12 + 1

If the process attempts to allocate an FD beyond this number, the behaviour is determined by the code itself, or if no provision is made by the code, the process will be issued a HUP or KILL signal, or be coredumped depending on the unix flavour.

The effect being that your process is stopped when it reaches a limit you have set.

The advantage of this method is that you can run a script that sets ulimit, then executes the underlying process in the FOREGROUND, but in a never ending loop.  When the process dies, the loop will cycle, and you can do some quick maintenance, and then restart the process.  No delays are necessary while you wait for a cron job to kick in.

Note that the semantics of ulimit are slightly different by flavour of unix, so you should test this technique thoroughly.
 
05.08.2007 at 04:44AM PDT, ID: 19048962
Actually, the reason I need to monitor is that I have a file handle leak that I cannot fix (in 3rd party code) and I need to be prepared to restart the process when the number available is getting low. The OS kernel is configured for 8000 per process. The process is already under a management system that restarts it, but I prefer to do it gracefully rather than waiting for errors.
 
05.13.2007 at 04:00AM PDT, ID: 19080781
Glad to hear you resolved the problem yourself; i suggest you post a (0 point) question in http://www.experts-exchange.com/Community_Support/General/ with the link to this question, asking them to accept your solution at
http://www.experts-exchange.com/Q_22551088.html#a19032800
as the answer and refund your points
 
05.17.2007 at 04:35PM PDT, ID: 19112628
A request has been made in Community Support to close this question:
http://www.experts-exchange.com/Community_Support/General/Q_22578425.html

If there are no objections, a moderator will finalize this question in approximately 4 days by:
PAQ'ing the question and refunding the points
   
Please leave any recommendations here.

Vee_Mod
Experts Exchange Moderator
 
05.20.2007 at 01:53PM PDT, ID: 19124032
Closed, 250 points refunded.
Vee_Mod
Community Support Moderator
Accepted Solution
 
 
20080716-EE-VQP-32