I have a Java program runs (on linux) for a while and then causes the server to lock up with "Too many files open"
After restarting the machine, I run the java program again and then execute the lsof command against it's pid. A large number of lines with the following output are produced:
java 971 uknown 980u sock 0,9 0t0 20461 protocol: TCPv6
Does this means the program is opening multiple tcp connections & not closing them?
What further steps can i take to troubleshoot this?
It means your program is opening file descriptors but not closing them. It may be sockets or file handlers. So it is causing resource leak. Make sure all file handlers are closed and make it ready for garbage collected.
As dan1st pointed out in comment, one preventive measure to avoid this scenario is using try-with-resources. This will implements the AutoClosable interface and make sure automatic resource closing.