albers@ka3ovk (Jon Albers) (04/05/91)
We have been working on a problem with some kind of runaway process or processes involving several Informix 3.3, SQL, and 4GL applications running on our production mini. Something in one or more of the above applications starts opening files, so much so that I get file table overflow errors and any Informix process that attempts to open a files thereafter hangs and must be killed by root. Once the processes are killed, sar reports the number of open files drops dramatically, and the system functions normally. My problem is Iam not sure which process(es) is/are opening the files. Is there a way to find out the process id of a process that has a file open? Is there a way to list open files by process id, name, and/or inode? I want to be able to find out where the error starts. Jon -- | Jon Albers, IRS, Information Systems Management, Support and Installation. | | Office Symbols: ISM:S:S:SI voice: (202/FTS)535-3729 Packet: KA3OVK@N4QQ | | UUCP:(media|teemc|tcsc3b2|ki4pv)!ka3ovk!albers ARPA: JALBERS@SIMTEL20 |
jfh@rpp386.cactus.org (John F Haugh II) (04/08/91)
In article <1991Apr04.201719.3587@ka3ovk> albers@ka3ovk.irs.gov.UUCP (Jon Albers) writes: >Is there a way to find out the process id of a process that has a file open? >Is there a way to list open files by process id, name, and/or inode? I >want to be able to find out where the error starts. Two commands will tell you has a file open - "fuser" and "ofiles". "fuser" is standard with System V. "ofiles" I believe is mostly a SunOS command, I'm sure someone from that universe can fill you in. You might also want to look into the "crash" command, particularly the "user" subcommand. It will tell you about open files per process. You can then determine the files each process has open by going from the open file descriptor information to the file table to the inode table. -- John F. Haugh II | Distribution to | UUCP: ...!cs.utexas.edu!rpp386!jfh Ma Bell: (512) 832-8832 | GEnie PROHIBITED :-) | Domain: jfh@rpp386.cactus.org "If liberals interpreted the 2nd Amendment the same way they interpret the rest of the Constitution, gun ownership would be mandatory."
jc@minya.UUCP (John Chambers) (04/13/91)
In article <19168@rpp386.cactus.org>, jfh@rpp386.cactus.org (John F Haugh II) writes: > In article <1991Apr04.201719.3587@ka3ovk> albers@ka3ovk.irs.gov.UUCP (Jon Albers) writes: > >Is there a way to find out the process id of a process that has a file open? > >Is there a way to list open files by process id, name, and/or inode? I > >want to be able to find out where the error starts. > > Two commands will tell you has a file open - "fuser" and "ofiles". "fuser" > is standard with System V. "ofiles" I believe is mostly a SunOS command, > I'm sure someone from that universe can fill you in. If your Sys/V is like this one, you may have to do some tweaking to get fuser to a usable state. When I typed it into a non-super-user window, I got a "not found" message. Hunting about turned it up quickly, in /etc, but when I typed /etc/fuser, the response was: /etc/fuser: /dev/kmem: Permission denied Investigating further showed: -r-xr-xr-x 1 bin bin 13404 Sep 20 1989 /etc/fuser As a result, fuser as installed is only usable by a super-user; it totally fails for all other users. I linked it into bin and modified it to be setgid-kmem, and now it works. Unfortunately, it still isn't exactly what I'd call a user-friendly program. It produces a process id. This is understandable, but for most users, this implies typing ps -ef and grepping for the output of fuser. So I wrote a little script. At least I didn't have to grovel through fuser's output with sed or awk to strip away assorted junk; they were programmer-friendly if not user-friendly in having it produce just the process id and nothing else. Sometimes saying that a command is "standard with System V" is not quite all you need to know for a user to be able to make use of it. -- All opinions Copyright (c) 1991 by John Chambers. Inquire for licensing at: Home: 1-617-484-6393 Work: 1-508-486-5475 Uucp: ...!{bu.edu,harvard.edu,ima.com,eddie.mit.edu,ora.com}!minya!jc