| Author |
Too many open files error
|
swapnel surade
Ranch Hand
Joined: Mar 05, 2009
Posts: 129
|
|
Hi,
I'm getting one java exception when I run my application on linux terminal.
It showing me the exception as "Too many open files . Error : 24".
Its File descriptor error. I dont know how to tackle this issue.
If anybody knows about this error please help me.
thanks
|
 |
Freddy Wong
Ranch Hand
Joined: Sep 11, 2006
Posts: 959
|
|
You can try to increase the number of file descriptors. The syntax is
|
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
|
 |
swapnel surade
Ranch Hand
Joined: Mar 05, 2009
Posts: 129
|
|
I have tried that also but its not working as after some time that error occurs.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
|
You're probably just leaking file descriptors. Make sure you close every file you open when you're done with it.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
Ernest Friedman-Hill wrote:You're probably just leaking file descriptors. Make sure you close every file you open when you're done with it.
And that includes doing the close in a "finally" clause if there's a possibility that an exception would occur that would cause the normal close to be bypassed. I've run into systems that leaked slowly because MOST of the time, execution proceeded normally, but occasional exceptions would leak resources.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
|
I was reviewing some code the other day by a junior developer that simply didn't close files at all. On questioning, it turned out he figured the garbage collector would do it.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
Ernest Friedman-Hill wrote:I was reviewing some code the other day by a junior developer that simply didn't close files at all. On questioning, it turned out he figured the garbage collector would do it.
I forgive him (her?). The early docs made such a big thing about how Java collects garbage. And as a pioneer vendor of C++, I'd gotten accustomed to having destructors do exactly that.
However, I got assigned to fix a project that was, in fact, leaking resources (network connections, actually), and now I know better.
|
 |
 |
|
|
subject: Too many open files error
|
|
|