• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Too many open files error

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try to increase the number of file descriptors. The syntax is

 
swapnel surade
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried that also but its not working as after some time that error occurs.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're probably just leaking file descriptors. Make sure you close every file you open when you're done with it.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic