Build dies occasionally due to file handle leakage

Project:JNode Builder
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

About one JNode build in ten fails for me with a message like the following. It looks like something is leaking open files in the ant build. Running the build again usually succeeds, but sometimes I need to run "./build.sh clean" first.

IMO, the most likely culprit is one of our custom build tasks. I expect that the reason we see this failure only occasionally is that the GC closes any open file handles that are identified as garbage.

BUILD FAILED
/home/stephen/jnode-dev/all/build.xml:418: The following error occurred while executing this line:
/home/stephen/jnode-dev/all/build.xml:381: The following error occurred while executing this line:
java.io.FileNotFoundException: /home/stephen/jnode-dev/all/build-x86.xml (Too many open files)

#1

Is this 32bit or 64bit build environment?
I never got that back with 32bit but I was seeing this very often with 64bit (much more as your 10%). I have no clue where this exactly comes from, but I have a local "workaround". Most Linux distributions set the filehandle limit to 1024 (check with ulimit -n). I simply increased it to 2048 and never had a failing build since then.

To increase the limit, edit the file /etc/security/limits.conf and add a line like

_username_          -          nofile          2048

where _username_ is your account name.

#2

I'm using a 32bit build environment.

Thanks for the workaround ...