[Sussex] PANIC: Too many files open error

Geoff Teale Geoff.Teale at claybrook.co.uk
Tue Dec 17 10:27:01 UTC 2002


Dominic wrote:
--------------
> Hi all,

Morning!

> I am having a nightmare with some java code that I am working 
> on, and people
> are starting to get uneasy with me...

Oh dear..

> Is this a sensible thing to do?  Something tells me, I am 
> just hiding from
> the real problem, which could be my connection pooling is not 
> really up to
> scratch!!! 
> That said, how much harm would I be doing by changing this 
> setting?  If it
> woreked then it buys me time to fix stuff properly.
> 
> What exactly is a 'file handle'?  Why would I be exceeding it?  Is it
> something to do with a TCP connection?

IIRC a file handle is a kernel level structure used to uniquely identify a
file (or another object represented in the filesystem) whilst it is in use.
You're code is causing lots of files (or virtual files) to be accessed
concurrently and thus overruning the default maximum number allowed by the
kernel.

It _is_ safe to increase this value as suggested in the help you found, but
remember that each file handle is using a few bytes of memory - you don't
want to overload the machine.  

Assuming you've got a reasonable spec server I would put it up to 16384 for
starters (it should cope with this easily.. the default 8192 is _very_
conservative).  

It may be that the speed of execution is a problem here and that simply
raising the limit will allow the code enough file handles to execute what it
needs to and then release the handles, on the other hand you may have
uncovered a serious problem.  As you correctly state this is not something
you can fix in Java itself - the problem could be in the JDBC driver your
using - you are correct in your assumption that connection pooling may not
be working correctly - but again, it may be that it just doesn't have time
to complete it's work before the error occurs.  My advice is this, raise the
limit, try the simple solution first before looking for something more
complex - I'm fairly sure that people would not release JDBC driver code
with a bug of this kind.

 
-- 
geoff.teale at claybrook.co.uk
geoff at tealeg.uklinux.net
      _________________________________
     / _______________  ______  ______/\
    / /\_____________/ /\____/ /\_____\/
   / / / __   __    / / /   / / /
  / / / / /\ / /\  / / /   / / /
 / /_/_/ / // /_/_/ / /   / / /
/_______/ //_______/ /   /_/ /
\_______\/ \_______\/    \_\/



The above information is confidential to the addressee and may be privileged.  Unauthorised access and use is prohibited.
 
Internet communications are not secure and therefore this Company does not accept legal responsibility for the contents of this message.
 
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
 
Claybrook Computing Limited is a subsidiary of Claybrook Computing (Holdings) Limited
Registered Office: Abbey House. 282 Farnborough Road, Farnborough, Hampshire GU14 7NJ
Registered in England and Wales No 1287205
 
A Hogg Robinson plc company





More information about the Sussex mailing list