File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Too many open files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Too many open files" Watch "Too many open files" New topic
Author

Too many open files

Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

I was doing some load testing on my server and all at once the processes start dying with the message:

Anyone familiar with this issue and how to resolve it? I was accessing the files via iText library, so I don't have direct access to close the connections (as far as I know).

[OCA 8 Book] [Blog]
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Scott Selikoff wrote:I was doing some load testing on my server and all at once the processes start dying with the message:

Anyone familiar with this issue and how to resolve it? I was accessing the files via iText library, so I don't have direct access to close the connections (as far as I know).

Do you know which code opens and reads the file? It doesn't seem to close the file properly after read.


“Everything should be as simple as it is, but not simpler.” Albert Einstein
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

I thought of that but I don't really have access to the streams. For example, two of the files are loaded via iText methods into objects that don't seem to have an equivalent close() method:

http://1t3xt.info/api/com/lowagie/text/Image.html#getInstance(java.lang.String)
http://1t3xt.info/api/com/lowagie/text/pdf/BaseFont.html#createFont(java.lang.String,%20java.lang.String,%20boolean)

I can try reorganizing the code into more reusable objects, but thats avoiding the issue, not really solving it.
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Not sure what server technology that you are using. But I think to work around you can use singleton to create and cache the image instance then use
getInstance(com.lowagie.text.Image) to create different object instances to avoid IO overheads. It should work.
Hope it help,

Duc
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Too many open files