Short “FTR”
Not really specific to perl, but handy anyway.
You can use strace
utility to inspect the syscalls (filesystem and network operations are usually of most interest) that a process is making.
here’s e.g. how you can see all network activity for a given process:
strace -p $PID -f -e trace=network -s 10000 |
Also if you have a stuck process you can check if it is waiting on some filehandle read and then check what that filehandle is using
lsof -p $PID |
Also filehandles could be found in /proc/$PID/fd/ – so if you run strace on your process and see e.g.
write( 3 , "foo\n" , 4 ) |
you can check aforementioned lsof | grep $PID and see this
perl 9014 bturchik 3w REG 253 , 3 4 26758 /tmp/hung |
or
ls -l /proc/ 9014 /fd/ 3 |
and see this:
l-wx------ 1 bturchik users 64 Aug 6 09 : 43 /proc/ 9014 /fd/ 3 -> /tmp/hung |