The number of files that can be in open state at any point of time is specific to the OS (offcourse ,Can be configured) and you have reached the upper limit of that.Look in the code base of your application ,whehter you have some code that is trying to open a file but not closing the stream after its use.Check for such codes.
To the best of my knowledge , the descriptor table is shared by files , sockets etc.So if you have too many sockets open , that might also cause.But this varries from OS to OS.Some OS might choose to maintain seperate tables for different descriptors.Different table for file descriptor and different table for sockets.
Joined: Jan 11, 2007
Is there a way i can find out number of open files or sockets in the system or how to configure the no. of open files or sockets the system can handle??
I know this is getting away from java but if some one can help me solve my problem i would be really gartefull!
Joined: Nov 29, 2005
You can use ulimit -a command in UNIX for getting information about the nofiles (descriptor) parameter and can increase the value also , but I really do not think that this is the solution for this problem.You should try to look for fault code in you application only.
I have made the changes as told by you but it isn't making much diffrence
If some other application is reading and writting from files like Virus scan(Which is reading files from scanning ) and windows process lsass.exe which is reading and writing files for security authorizations.
Unlikely, as other applications would have seperate descriptor tables. Try using Process Explorer to examine what file descriptors your appliation has open. You may have the same problem with other files/sockets/database connections/etc.
BufferedWriter (and all buffered classes) checks to see when its buffer is going to overflow and flushes automatically. You can check for yourself. The source for the JDK classes is in a src.zip file in your JDK install directory (if you opted to install it, that is). In any case, I'd expect a problem in the Writer to throw an IOException. An exception reporting "too many open files" is almost certainly related to the OS's restriction on the number of file descriptors a process may have open at one time.
subject: java.io.FileNotFoundException ( Too many open files )