Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seeing too many lsof can't identify protocol


I have a Java process/app. When I run /usr/sbin/lsof -p on that java process, I see a lot of "can't identify protocol". Also, interestingly, File descriptors(FDs) are increasing at a very steady rate. And those FDs that are being created are having description as "can't identify protocol".

So, is there any way to instrument/profile the java process so as to nail down who is creating that many FDs. Any detailed explanation on any tool would be really really helpful.

A quick google search tells me strace is one way but IIUC, that will show linux system calls coming out of the java process. I am more interested in which part of my java code is behaving badly than what system calls are being generated.

Again, any ideas/suggestions would be simply great!

like image 864
Johnny Avatar asked Oct 27 '11 04:10

Johnny


3 Answers

Lsof prints can't identify protocol for half-open TCP/IP connections: https://idea.popcount.org/2012-12-09-lsof-cant-identify-protocol/

like image 135
Marek Avatar answered Nov 03 '22 21:11

Marek


When lsof prints "Can't identify protocol", this usually relates to sockets (it should also say 'sock' in the relevant output lines).

So, somewhere in your code you are probably connecting sockets and not closing them properly (perhaps you need a finally block).

I suggest you step through your code with a debugger (easiest to use your IDE, potentially with a remote debugger, if necesssary), while running lsof side-by-side. You should eventually be able to see which thread / line of code is creating these File Descriptors.

See point 10.2.2 of this FAQ for more details about the Lsof output.

like image 38
laher Avatar answered Nov 03 '22 20:11

laher


Maybe you observe bug in JVM 1.6 with leak of connections when you use SSL and hostname: http://bugs.sun.com/view_bug.do?bug_id=6745052

like image 26
Michał Niklas Avatar answered Nov 03 '22 20:11

Michał Niklas