This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 149261

Summary: Too many open files when building project for jboss 4.2.3
Product: java Reporter: rukus <rukus>
Component: SourceAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: anebuzelsky, lhasik, mmirilovic, musilt2, pnejedly, tzezula
Priority: P3 Keywords: RELNOTE
Version: 6.x   
Hardware: PC   
OS: Unix   
Issue Type: DEFECT Exception Reporter:
Attachments: Error messages
Error messages
lsof -p output
Requested log file

Description rukus 2008-10-06 16:09:25 UTC
Too many open files when building project for jboss 4.2.3 (with jboss 4.2.3 works fine)

OS Ubuntu 8.04

Ulimit info
seth@seth-desktop:~$ ulimit
unlimited

seth@seth-desktop:~$ java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)


----------------------------------------------------Output---------------------------------------------------------
Compiling 173 source files to /home/seth/java/CIM_WS/build/web/WEB-INF/classes
error: error reading /home/seth/java/CIM_WS/src/blah/blah/blah/Blah.java;
/home/seth/java/CIM_WS/src/blah/blah/blah/Blah.java (Too many open files)
....
....
....
100 errors
/home/seth/java/CIM_WS/nbproject/build-impl.xml:392: The following error occurred while executing this line:
/home/seth/java/CIM_WS/nbproject/build-impl.xml:213: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)
----------------------------------------------------Output---------------------------------------------------------
Comment 1 Petr Hejl 2008-10-06 16:14:27 UTC
Can you provide IDE version?
Comment 2 Tomas Danek 2008-10-06 16:58:03 UTC
are you able to reproduce also from command line with your (non-NetBeans) Ant?
Comment 3 Tomas Danek 2008-10-06 17:00:03 UTC
btw.steps to reproduce the problem are highly appreciated.
Comment 4 rukus 2008-10-07 07:30:00 UTC
IDE version is 6.1 (same that i've selected in issue description)

>>>are you able to reproduce also from command line with your (non-NetBeans) Ant?
hmm what should i type in terminal to do that?
Comment 5 rukus 2008-10-07 07:54:48 UTC
Hmm - today i can't reproduce same problem but i've encountered related - see 2 attached screenshots
Comment 6 rukus 2008-10-07 07:56:00 UTC
Created attachment 71258 [details]
Error messages
Comment 7 rukus 2008-10-07 07:56:30 UTC
Created attachment 71259 [details]
Error messages
Comment 8 rukus 2008-10-07 07:58:39 UTC
Looks like problem occurs when i've opened 2 big projects - with many source files
Comment 9 rukus 2008-10-07 08:26:33 UTC
Ok - i found steps to reproduce problem:
1. Create new Web project
2. Close it
3. Add to it's sources around 10k files
4. Open project
Comment 10 Antonin Nebuzelsky 2008-10-07 08:56:26 UTC
Milosi, take this one.
Comment 11 Milos Kleint 2008-10-07 11:00:22 UTC
rukus:
please check the total number of file handles on your system 
(cat /proc/sys/fs/file-max)
and number assigned to your user on the system
(cat /etc/security/limits.conf or cat /etc/limits)

Also when encountering the bug, please list the handles opened by the netbeans java process.
ls -la /proc/<pid>/fd
or
lsof -p <pid>

where pid is the process id of the java vm that runs netbeans. (ps -ax to figure)

for details see this document for example:
http://confluence.atlassian.com/display/DOC/Fix+%27Too+many+open+files%27+error+on+Linux+by+increasing+filehandles


closing as works for me, please reopen with the information requested
Comment 12 rukus 2008-10-07 12:59:55 UTC
seth@seth-desktop:~$ cat /proc/sys/fs/file-max
100631
seth@seth-desktop:~$ cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - an user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to
#        - rtprio - max realtime priority
#        - chroot - change root to directory (Debian-specific)
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#ftp             -       chroot          /ftp
#@student        -       maxlogins       4

# End of file

I've set 
fs.file-max to 200000
Looks like i need to reboot system - if it won't help i will post here result of 

lsof -p <pid>
Comment 13 rukus 2008-10-07 13:10:35 UTC
after reboot:

seth@seth-desktop:~$ cat /proc/sys/fs/file-max
200000

But problem is still here - see output of lsof in attachments
Comment 14 rukus 2008-10-07 13:11:56 UTC
Created attachment 71279 [details]
lsof -p output
Comment 15 Milos Kleint 2008-10-07 13:32:40 UTC
it seems there are 2 culprits here:
module system - 692 open module jars
java support - 530 open index files

reassigning to module system, I believe pnejedly has fix some open file related issues (not sure if before or after 6.1)

->P2, there's a workaround, you can set the number of open handles per project in the etc's limits configuration file.
Comment 16 Milos Kleint 2008-10-07 13:38:35 UTC
sorry not per project but per user
Comment 17 rukus 2008-10-07 13:44:10 UTC
->P2, there's a workaround, you can set the number of open handles per project in the etc's limits configuration file.

Can you provide additional info how to do this workaround?

P.S. Thanks for your time and quick response to my problem :)
Comment 18 Milos Kleint 2008-10-07 14:02:02 UTC
I would say you have to edit the limits file
<username> hard nofile 5000
to increase the limit of opened files.


Additionally you can try with latest 6.5 dev (or beta) to see if the issue with module system was indeed improved in 6.5
Comment 19 rukus 2008-10-08 07:58:32 UTC
Looks like workaround helps

What about NB6.5 i think i should file new bug cos arrows and backspace don't work in editor window :(
Comment 20 Jaroslav Tulach 2008-10-09 12:40:04 UTC
I cannot reproduce the problem. The number of open module JARs is kept at 300 on my computer. I need more logs. Please 
get the build that contains fix ca9d5ef6fa6e, run with
-J-Dorg.netbeans.JarClassLoader.level=406
parameter. Attach $userdir/var/log/messages.log and reopen.
Comment 21 Quality Engineering 2008-10-10 05:58:46 UTC
Integrated into 'main-golden', will be available in build *200810100201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ca9d5ef6fa6e
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #149261: More logging to track down cause of too many open JARs
Comment 22 rukus 2008-10-13 10:21:31 UTC
Created attachment 71646 [details]
Requested log file
Comment 23 rukus 2008-10-13 10:24:46 UTC
added attachment
Comment 24 Jaroslav Tulach 2008-10-13 15:54:55 UTC
The last log shows there is ~300 opened module JARs. And yes, looking at the lsof output, there is ~300 opened module 
JARs. Just some of there are listed twice:

java    5822 seth  mem    REG                8,3  4227036 1012172 java2/modules/org-netbeans-modules-form.jar
java    5822 seth  332r   REG                8,3  4227036 1012172 java2/modules/org-netbeans-modules-form.jar

According to Tomáš the JAR is still opened once, just the central table is mmapped and the rest of the JAR is open for 
reading. I would say things are perfectly OK, then! 

Because workaround exists and is documented in relnotes, I am changing this to P3.
Comment 25 Jaroslav Tulach 2008-10-14 07:52:05 UTC
While looking at
http://www.netbeans.org/nonav/issues/showattachment.cgi/71279/log2.txt
I see ~300 opened modules
I see a lot of libraries opened by JVM.
I see bunch of ant JAR files
I see ~700 files opened by java.

I can't help myself, but I think this issue has nothing to do with NetBeans Module System. It has limit of 300 and it 
does not grow over it.
Comment 26 Quality Engineering 2008-10-28 05:04:28 UTC
Integrated into 'main-golden', will be available in build *200810280201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/470dfb96f82a
User: Jesse Glick <jglick@netbeans.org>
Log: More detailed logging for #149261: shows forWhat parameter.
Comment 27 Jan Lahoda 2011-09-01 07:42:25 UTC
Already fixed as bug #171252.

*** This bug has been marked as a duplicate of bug 171252 ***