?
Solved

Monitoring number of file descriptors

Posted on 2006-03-24
3
Medium Priority
?
345 Views
Last Modified: 2013-12-27
On a sun based system, I am running an expect script that after running for some number of iterations, crashes with a "sync byte read" error. We have found this to be that the limit number of file descriptors was too low (shown by "limit -n"), and upon increasing this limit the problem was solved.

I would like to monitor the number of file descriptors that are actually in use at any given time in order to determine how much we actually need to increase this limit by in order to be safe for the size job that we are running. I can not seem to find the right command.

Thanks,
Justin
0
Comment
Question by:justinsane
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
sheetbird earned 500 total points
ID: 16284471
/usr/bin/pfiles <pid>  

Will list all the file descriptors, you'll have to do some fancy grep | wc to just get a number.



0
 
LVL 10

Expert Comment

by:Nukfror
ID: 16290692
bash-3.00# pfiles $$
670:    bash -o vi
  Current rlimit: 256 file descriptors
   0: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
      O_RDWR|O_NOCTTY|O_LARGEFILE
      /devices/pseudo/pts@0:1
   1: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
      O_RDWR|O_NOCTTY|O_LARGEFILE
      /devices/pseudo/pts@0:1
   2: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
      O_RDWR|O_NOCTTY|O_LARGEFILE
      /devices/pseudo/pts@0:1
   3: S_IFDOOR mode:0444 dev:279,0 ino:57 uid:0 gid:0 size:0
      O_RDONLY|O_LARGEFILE FD_CLOEXEC  door to nscd[108]
      /var/run/name_service_door
 255: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
      O_RDWR|O_NOCTTY|O_LARGEFILE FD_CLOEXEC
      /devices/pseudo/pts@0:1
bash-3.00# pfiles $$ | egrep "^ +[0-9]"
   0: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
   1: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
   2: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
   3: S_IFDOOR mode:0444 dev:279,0 ino:57 uid:0 gid:0 size:0
 255: S_IFCHR mode:0620 dev:270,0 ino:12582918 uid:0 gid:7 rdev:24,1
bash-3.00# pfiles $$ | egrep "^ +[0-9]" | wc -l
       6
0
 
LVL 10

Expert Comment

by:Nukfror
ID: 16290706
The final command above shows "6" because the final example includes a sixth file descriptor to handle the pipe symbol in "| wc -l" command.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question