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 61281 - Tip Query sometimes consumes 100% CPU "forever"
Summary: Tip Query sometimes consumes 100% CPU "forever"
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords: PERFORMANCE
: 62956 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-22 10:53 UTC by Jan Lahoda
Modified: 2007-11-05 13:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Suspect stack traces. (4.12 KB, text/plain)
2005-07-22 10:55 UTC, Jan Lahoda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Lahoda 2005-07-22 10:53:11 UTC
Own build from 19 July.

Sometimes, the tip completion query starts to consume 100% of CPU "forever". I
do not have a reproducible test case. I am attaching a few stack traces that
shown the suspect thread.
Comment 1 Jan Lahoda 2005-07-22 10:55:55 UTC
Created attachment 23236 [details]
Suspect stack traces.
Comment 2 Jan Lahoda 2005-08-24 15:09:51 UTC
*** Issue 62956 has been marked as a duplicate of this issue. ***
Comment 3 Antonin Nebuzelsky 2005-08-31 11:28:29 UTC
This is a potential beta stopper. Must be evaluated ASAP and fixed if possible.
Comment 4 Martin Roskanin 2005-08-31 12:53:26 UTC
it looks that under some condition there is a neverending loop in
JavaCompletionQuery.tipQuery():

while (cont) {
  sup.tokenizeText(tp, (((lastSepOffset + 1) <= offset) ? lastSepOffset + 1 :
offset), offset, true);
  if (cont = tp.isStopped()) {
      lastSepOffset = sup.findMatchingBlock(tp.getCurrentOffest(), true)[0];
  }
}
Comment 5 Martin Roskanin 2005-08-31 13:29:24 UTC
Honza, in what JDK version did you reproduced it?
It seems the issue depends on the specific tokens conditions before caret
position... If you will reproduce it again try to find out what exact expression
you completed and tokens before.
Comment 6 Jesse Glick 2005-08-31 16:44:14 UTC
Surely you can insert some code before the loop that estimates an upper bound on
how many times the loop could possibly run, and if that is exceeded, break the
loop and notify an exception with as much diagnostic info as you need? Then if
it happens again we won't have to guess why.
Comment 7 Miloslav Metelka 2005-09-01 22:28:33 UTC
I have added the safety counter to the while() cycle. It will list the
problematic offset and inform the user to attach the particular source file to
this issue so that we can track the problem. The infinite loop will be broken so
the user should be able to continue editing.
 I mark this as fixed for now until we obtain the problematic case.
Comment 8 Miloslav Metelka 2005-09-01 22:29:15 UTC
in trunk:
Checking in lib/src/org/netbeans/editor/ext/java/JavaCompletionQuery.java;
/cvs/java/editor/lib/src/org/netbeans/editor/ext/java/JavaCompletionQuery.java,v
 <--  JavaCompletionQuery.java
new revision: 1.6; previous revision: 1.5