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 88462 - 100% CPU
Summary: 100% CPU
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords: PERFORMANCE, RANDOM
: 88869 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-11-01 21:08 UTC by Jesse Glick
Modified: 2007-01-17 10:09 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stderr incl. thread dumps (17.52 KB, application/x-gzip)
2006-11-01 21:09 UTC, Jesse Glick
Details
Heap histogram (131.29 KB, application/x-gzip)
2006-11-01 21:23 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2006-11-01 21:08:08 UTC
061031. I was in the middle of editing a source file in a simple j2seproject and
had invoked code completion (source was probably malformed at the time) when CPU
usage suddenly went to 100% and the IDE become mostly unresponsive. I took a
number of thread dumps. Also the IDE got an OOME and I got an automated heap
dump in jhat format.
Comment 1 Jesse Glick 2006-11-01 21:09:05 UTC
Created attachment 35710 [details]
Stderr incl. thread dumps
Comment 2 Jesse Glick 2006-11-01 21:23:37 UTC
Created attachment 35711 [details]
Heap histogram
Comment 3 Jesse Glick 2006-11-02 15:34:03 UTC
IIRC I had a project which I had recently switched to 1.4 source level and had
something like this:

main(...) {
  for (Map.Entry e : System.getProp
                                   ^^^ CC
}
Comment 4 Jesse Glick 2006-11-02 16:12:49 UTC
Of course I cannot reproduce in a new project; the editor offers CC quickly, I
accept, the background compiler warns about the unsupported construct, and all
is well.

The actual class I had, *after* making various changes and switching source
level back to 1.5:

---%<---
package uservariantproperty;
import java.util.Map;
public class Main {
    public static void main(String[] args) {
        System.out.println("user.variant=" + System.getProperty("user.variant"));
        System.out.println("----");
        for (Map.Entry e : System.getProperties().entrySet()) {
            String k = (String) e.getKey();
            if (k.startsWith("user.")) {
                //System.out.println("" + k + "=" + e.getValue());
                System.out.println(e);
            }
        }
    }
}
---%<---
Comment 5 Jesse Glick 2006-11-09 17:10:21 UTC
Haven't had such a problem since.
Comment 6 Dusan Balek 2006-11-13 09:54:33 UTC
*** Issue 88869 has been marked as a duplicate of this issue. ***
Comment 7 Dusan Balek 2006-11-13 10:37:07 UTC
From the attached thread dumps now I see that the problem is caused by the
Javadoc popup. To get a javadoc text, the souce file of the element being
displayed (class, method, field, etc.) is parsed together with sources of all
referred elements. Thus, if the element being displayed had many '@see" tags,
several javac instances were created and run simultaneously (as can be seen form
the attached heap histogram) out of the memory.

Working on a patch that would allow for parsing referred classes lazily.
Comment 8 Dusan Balek 2006-11-13 16:22:39 UTC
Fixed.

RCS file: /cvs/java/source/src/org/netbeans/modules/java/source/JavadocEnv.java,v
done
Checking in source/src/org/netbeans/modules/java/source/JavadocEnv.java;
/cvs/java/source/src/org/netbeans/modules/java/source/JavadocEnv.java,v  <-- 
JavadocEnv.java
initial revision: 1.1
done
Checking in source/src/org/netbeans/api/java/source/CompilationInfo.java;
/cvs/java/source/src/org/netbeans/api/java/source/CompilationInfo.java,v  <-- 
CompilationInfo.java
new revision: 1.3; previous revision: 1.2
done
Checking in source/src/org/netbeans/api/java/source/ElementUtilities.java;
/cvs/java/source/src/org/netbeans/api/java/source/ElementUtilities.java,v  <-- 
ElementUtilities.java
new revision: 1.3; previous revision: 1.2
done
Checking in source/src/org/netbeans/api/java/source/SourceUtils.java;
/cvs/java/source/src/org/netbeans/api/java/source/SourceUtils.java,v  <-- 
SourceUtils.java
new revision: 1.9; previous revision: 1.8
done
Checking in source/src/org/netbeans/api/java/source/JavaSource.java;
/cvs/java/source/src/org/netbeans/api/java/source/JavaSource.java,v  <-- 
JavaSource.java
new revision: 1.10; previous revision: 1.9
done
Checking in editor/src/org/netbeans/modules/editor/java/JavaCompletionProvider.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/JavaCompletionProvider.java,v
 <--  JavaCompletionProvider.java
new revision: 1.45; previous revision: 1.44
done
Checking in editor/src/org/netbeans/modules/editor/java/JavaCompletionDoc.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/JavaCompletionDoc.java,v 
<--  JavaCompletionDoc.java
new revision: 1.4; previous revision: 1.3
done