Frank de Lange said once upon a time:
>
>>Is there any way on your system of discovering which process is holding the lock on a file?
>
>You could try using lsof (LiSt Open Files), a tool which can be found at vic.cc.purdue.edu in the pub/tools/unix/lsof directory. This program show all (or some) open files on a system, related to the processes (PID's) which own the file descriptors. It gives a lot of info, including file open mode (r, w, r/w, locks, etc).
Here's the output from one "stuck" exim process. Doing a truss just shows
it sleeping for something. Its etime is at 6:44:40 (ie: six hours of doing
nothing).
Doing a lsof on the file reveals:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF INODE NAME
exim 15617 root cwd VDIR 32,8 512 51072 /var/spool/mqueue/exim
exim 15617 root txt VREG 32,30 477372 21952 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 21144 33812 /usr/lib/nss_files.so.1
exim 15617 root txt VREG 32,30 39932 33804 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 15720 33790 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 15720 33783 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 664776 33972 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 60316 33973 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 6432 33785 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 571940 33977 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 68780 33798 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 2564 33780 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root txt VREG 32,30 137160 33771 /usr (/dev/dsk/c0t3d0s6)
exim 15617 root 0uW VREG 32,8 660 74122 /var/spool/mqueue (/dev/dsk/c0t1d0s0)
exim 15617 root 1r VREG 32,24 33885 8014 /etc/mail/exim/system_filter
exim 15617 root 3w VREG 32,8 0 78801 /var/spool/mqueue (/dev/dsk/c0t1d0s0)
exim 15617 root 4w VREG 32,8 0 68753 /var/spool/mqueue (/dev/dsk/c0t1d0s0)
exim 15617 root 5r DOOR 0xf60259b0 (FA:->0xf5ca9980)
exim 15617 root 6u FIFO 0xf5d8abe0 0t0 1593372 PIPE->0xf5d8ac60
I hope someone can make sense of this. Exim's locking problems remain its
biggest problem for me.
--
*** Exim information can be found at
http://www.exim.org/ ***