Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any Java debugging tips for finding the cause of "Too Many Files Open"

I'm developing in a linux environment and the system is intended to run continuously over a long period of time. After an overnight test we see the FileNotFoundException with a message of "Too Many Files Open". We started logging the output of the lsof command at various times in the system to see if we can see what is happening. We noticed lots of unnamed pipes opened. So I figured these were due to File Streams not getting closed. I searched through the source for any *Stream objects used and made sure they were all getting closed in a finally{} block. Are there any other Java object types that I could search for that I might not be closing that would cause all these unnamed pipes to be opened?

Also, my ulimit is 1024 and I also searched for *Writer and made sure those were all closing too.

like image 564
Nikordaris Avatar asked Nov 04 '22 14:11

Nikordaris


1 Answers

YourKit might be worth a look. Its probes are meant to help with this type of problems, although I've never had the occasion to try that functionality myself.

like image 180
NPE Avatar answered Nov 11 '22 14:11

NPE