Bug 435450 - FileNotFoundException (FileNotFoundException) when number of open files is not near open files rlimit
FileNotFoundException (FileNotFoundException) when number of open files is no...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: java-1.6.0-openjdk (Show other bugs)
rawhide
All Linux
high Severity low
: ---
: ---
Assigned To: Thomas Fitzsimmons
Fedora Extras Quality Assurance
http://defect.opensolaris.org/bz/show...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-29 09:05 EST by Lubomir Kundrak
Modified: 2008-04-25 21:56 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-25 21:56:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lubomir Kundrak 2008-02-29 09:05:14 EST
I've had problem with OpenGrok dying with the above exception (see the URL).
We had an e-mail conversation Trond Norbye, so the sun bugzilla ticket is not up
to date. Interesting points are:

1.) I had set "ulimit -n 1000000"
2.) Running this [1] returned a number very close to the actual ulimit
3.) Monitoring the count of open file descriptors of running OpenGrok each
second was showing values rising and falling, generally in between 35 up to
around one thousand
4.) OpenGrok constantly opens and closes files.
5.) At the time of dying OpenGrok has 1049 files open. That if far less than
rlimit. (measured with [2])
6.) Trond provided a patch that mitigated the problem by keeping the number of
open file handles low, currently it is ~60. The fix was following:

 "try { in.close(); } catch (Exception e) {}"

at the end of function that was opening the files.

[1] http://people.redhat.com/lkundrak/opengrok-debug/Filecounter.java
[2] http://people.redhat.com/lkundrak/opengrok-debug/fds-probe.stp

My questions are -- when does java throw that exception? Does it return that in
case it gets an error condition from open(2) or does it keep its own count? If
it does keep its own count, why did [1] testcase differ from what seems to be
limit for OpenGrok? Does that look like a java VM bug?

(reproducible with Sun java 1.6.0 (latest patchset) as well as Icedtea in F8.
Comment 1 Thomas Fitzsimmons 2008-04-25 21:56:50 EDT
> when does java throw that exception?

FileNotFoundException is thrown from fileOpen in
openjdk/jdk/src/solaris/native/java/io/io_util_md.c.

> Does it return that in case it gets an error condition from open(2) or does it
> keep its own count?

fileOpen calls JVM_Open.  JVM_Open, through layers of macros, invokes the open
system call which returns the "(Too many open files)" error.

> If it does keep its own count, why did [1] testcase differ from what seems to
> be limit for OpenGrok?

Did you trace the code path through OpenGrok from where the exception is thrown
to where exit(2) is called?  It may be that OpenGrok closes some of its open
file descriptors.

> Does that look like a java VM bug?

Doesn't look like it, no.  Your SystemTap script and Filecounter test case
showed expected results on my Rawhide x86 machine.  If you want me to
investigate further you'll have to describe how to run OpenGrok to reproduce the
behaviour you're seeing.  For now I'm closing this.

Note You need to log in before you can comment on or make changes to this bug.