We are using java.net.Socket to open a socket (snmp based communication) and we close the socket properly. But we are seeing "Too many open files" issue and this is happening in 184.108.40.206.
We dont see any problem (with the same code base) in JDK1.6.0_U3. The application is running without any issues..Even with the latest Java (1.7U4) we are seeing this problem.
I am seeing lot of file descriptor files opened under the /proc/<pid>/fd directory. But i couldnt read the file and all of them are UDP sockets.
And also our CPU usage goes upto 100% and we are not sure how to debug this problem. Clearly this pbm is not there in 1.6.0.U3, only with the later versions.. Can anyone facing this issue or help me to debug this issue? for me it looks like a java pbm...
You say "We are properly closing the socket" - I would make triple sure that you're doing that everywhere. I would also make triple sure that the exception is actually coming from socket handles and not something else like a file handle.
If you are sure then the only way forward is to create a small example program and see if you can reproduce it. If you can then you have the base for a bug report you should be making. If you can you should also try running on a different environment (for example if you're running on Windows, try running on a Linux JDK) to see if that makes a difference.
Just to be sure: this is not Oracle tech support. You're telling other Java programmers just like yourself.
Its Redhat. And as you said its purely UDP sockets opened by our application and though we are calling socket.close() , the reference is not completely cleaned up. And this pbm occurs only in JDK1.6U4 and not in JDK1.6U3.
I couldnt find anything in the JDK1.6U4 changelist, but i suspect some enhancements related to the GC ..
I am very sure. As i mentioned already, i have two different java installation ..When i run my product with JDK1.6U4 i am getting this problem , and not with JDK1.6U3. No code change, no environment change (apart from JAVA)
For me, when i switch to JDK1.6U4, getting this "Too many open files" , CPU goes to 98 %..
I guess I should've explained the thinking behind my question. If, for whatever reason, an unchecked Exception or Throwable is being thrown in the later JVMs that wasn't in the previous ones, and if you don't catch it, your Thread will just 'go away' possibly before the close() is executed. This happened to me on a server that was supposed to be monitoring a smoke alarm system. It was discovered after months of running that it stopped monitoring. I tracked it down to an uncaught NullPointerException causing the Thread to just go away. So now, after my known 'catches', I add a catch Throwable.
I know this is a long shot but if you've eliminated everything else, you might want to check to make sure there is no way this could be happening to you. It just seems to me that if this were a bug in the JVM, it would've been noticed long ago by others.