tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Boeckman <>
Subject Re: open filehandles
Date Tue, 25 Nov 2003 15:16:57 GMT wrote:
>>>As a shorter-term workaround, you might try one or more of the
>>> - if open filehandles are not maintained for individual class files,
>>>   try expanding your jars into each classloader's corresponding
>>>   "classes" directory (i.e shared/lib/*.jar into shared/classes,
>>>   etc).
>>I'm confused by this, why would I _want_ filehandles maintained for
>>individual classes?
> You don't.
>>Or am I misunderstanding your suggestion? Right now tomcat touches a
>>class and moves on, which is ideally what I want it to do with the
> Or, perhaps I misunderstood your observations.  Let me try to break it
> down into a little more detail.
>  - single class files: the class loader opens the .class file, loads the
>    class than closes the file.  No lingering open file handles.
>    (My read through your initial message gave me the impression that
>    this was the behavior you were observing).

that is correct

>  - jar files: classloader opens the jar file, does
>    decompression if necessary, and memory mapping of the jar contents,
>    then loads some number of classes from the jar (but not necessarily
>    all of them).  From an efficiency standpoint, it kind of makes
>    sense to keep a handle open, so that it's not necessary to do all
>    of that work repeatedly when searching for a class (see also
> If open FD's to jar files are the problem, try working around it by
> replacing the jars with the equivalent directory tree of expanded
> class files (where each class file will be opened, read, and closed as
> it is needed).

and that makes perfect sense now. I just needed it spelled out a little 
more I guess. Having read that FAQ the 'keeping those file handles open' 
does make sense to me.

What we have seen is our tomcat engine crash twice in the last 72 hours, 
and hadn't seen enough info to track down the specific cause, so I was 
really trying to just trim file handles down, and the .jar's seemed a 
likely candidate. However since my last post I have discovered that this 
looks like a nasty code bug in our software more than a simple 
tomcat-is-a-filehog problem, so we'll hit it from there. FWIW I did 
uncompress and recombine all jars in tomcat and my app into 3 .jar files 
and saw some significant decreases (1200+) in the number of filehandles 
open. So again, many thanks!


Matthew Boeckman			(816) 777-2160
Manager - Systems Integration		Saepio Technologies

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message