1819697 Members
3478 Online
109605 Solutions
New Discussion юеВ

lsof stuck

 

lsof stuck

What/how does lsof work? In trying to play around trying to identify Unidata user sessions and their port/pid correlation, I tried to do a lsof on one session via the "port" and the command has not returned going on now for 5 minutes. Looking for lsof, I discovered my command along with another one w/o any arguments and a PPID of 1.

Tried killing without and with -9 and yet the process prevails.
13 REPLIES 13
Aussan
Respected Contributor

Re: lsof stuck

what OS version do you have and also the lsof version you are running

and did you run the lsof command as root? or a user?
The tongue weighs practically nothing, but so few people can hold it
Aussan
Respected Contributor

Re: lsof stuck

also the exact command used
The tongue weighs practically nothing, but so few people can hold it

Re: lsof stuck

11.23 4.77 ran as root

Re: lsof stuck

lsof -i :199

Re: lsof stuck

was a typo - I had wanted to look at 1199 but inadvertently dropped off the trailing (or first 9). Yeah, yeah ├в lucky it wasn├в t a kill or something else like that. 8-).
Robert-Jan Goossens_1
Honored Contributor

Re: lsof stuck

try adding the protcol name (udp/tcp)

# lsof -i tcp:1199
A. Clay Stephenson
Acclaimed Contributor

Re: lsof stuck

There are two sections of the lsof man page that you should have read BEFORE using lsof: "BLOCKS AND TIMEOUTS" and "AVOIDING KERNEL BLOCKS". Lsof is kernel intrusive and can certainly block on some operations but you are allowed to adjust timeouts and void potentially blocking system calls using the -b option.
If it ain't broke, I can fix that.

Re: lsof stuck

Okay, I have been educated as to the future use of lsof AND reading through the entire manpage of a command before trying it. But what do I do now? Do they effectively become zombies and need to wait for a reboot to clear them out? Any potential harm - reason why I am asking is that the box hasn't been rebooted in almost 1/2 year and the people here frown on even thinking of rebooting....
Aussan
Respected Contributor

Re: lsof stuck

sorry i got confused a bit

the command you are trying is lsof -i:1199 or lsof -l?

and also can you do bdf on your system

i know that sometime if i have a dead nfs mount bdf does not work, and lsof does not work also...

The tongue weighs practically nothing, but so few people can hold it
Aussan
Respected Contributor

Re: lsof stuck

if it's a zombie process with ppid of 1 a reboot is the only way to clear it
The tongue weighs practically nothing, but so few people can hold it

Re: lsof stuck

Aussan,

No, no stuck unresolvable/unmountable mounts out there - bdf works.

Killed the parent of the one I fired off; the parent died but init inherited the surviving child now so there's two zombies.

Oh well...

Re: lsof stuck

Aussan,

and the command was lsof -i :119 - was trying to find out who/what was running on 1199.

Re: lsof stuck

chalking it up to just another learning experience.