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 246562 - Evaluating debugger watch triggers endless loop
Summary: Evaluating debugger watch triggers endless loop
Status: VERIFIED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-20 03:47 UTC by _ gtzabari
Modified: 2014-11-12 16:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2014-08-20 03:47:44 UTC
Product Version: NetBeans IDE Dev (Build 201408170001)
Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev

1. Start a debugging session.
2. Stop at a breakpoint
3. Add a new debugger watch: Paths.get(new URI("file://C:/test.jar")).toRealPath()
4. Netbeans will go into an endless loop, throwing exceptions forever.

This bug is quite bad because Netbeans keeps on stealing keyboard focus, making it very hard to even kill the process.

I believe two bugs need to be fixed:

1. There needs to be a mechanism which prevent bugs of this sort from triggering endless exceptions, stealing keyboard focus, and blocking the use of Exception Reporter.
2. The specific exception needs to be fixed.

The exception being thrown is:

SEVERE [org.openide.util.Exceptions]
During evaluation of 'Paths.get(new URI("file://C:/test.jar")).toRealPath()'
During evaluation of 'Paths.get(new URI("file://C:/test.jar")).toRealPath()'
Caused: java.lang.NullPointerException
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.createArrayMirrorWithDisabledCollection(EvaluatorVisitor.java:4398)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.transformVarArgsValues(EvaluatorVisitor.java:498)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitMethodInvocation(EvaluatorVisitor.java:464)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitMethodInvocation(EvaluatorVisitor.java:205)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1483)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitExpressionStatement(EvaluatorVisitor.java:1675)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitExpressionStatement(EvaluatorVisitor.java:205)
	at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1308)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitBlock(EvaluatorVisitor.java:1580)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.visitBlock(EvaluatorVisitor.java:205)
	at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:924)
	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:50)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.scan(EvaluatorVisitor.java:244)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorVisitor.scan(EvaluatorVisitor.java:205)
	at org.netbeans.modules.debugger.jpda.projects.EditorContextImpl.parseExpression(EditorContextImpl.java:2181)
	at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.netbeans.modules.debugger.jpda.EditorContextBridge.parseExpression(EditorContextBridge.java:130)
	at org.netbeans.modules.debugger.jpda.expr.TreeEvaluator.evaluate(TreeEvaluator.java:187)
	at org.netbeans.modules.debugger.jpda.JavaEvaluator.evaluateIn(JavaEvaluator.java:144)
	at org.netbeans.modules.debugger.jpda.JavaEvaluator.evaluate(JavaEvaluator.java:92)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorExpression$AssociatedExpression.evaluate(EvaluatorExpression.java:90)
	at org.netbeans.modules.debugger.jpda.expr.EvaluatorExpression.evaluate(EvaluatorExpression.java:73)
	at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.evaluateGeneric(JPDADebuggerImpl.java:962)
	at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.evaluateIn(JPDADebuggerImpl.java:831)
	at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.evaluateIn(JPDADebuggerImpl.java:854)
	at org.netbeans.modules.debugger.jpda.models.WatchesModel$JPDAWatchEvaluating.getValue(WatchesModel.java:435)
	at org.netbeans.modules.debugger.jpda.models.WatchesModel$JPDAWatchEvaluating.getType(WatchesModel.java:393)
	at org.netbeans.modules.debugger.jpda.ui.models.VariablesTreeModelFilter.getFilter(VariablesTreeModelFilter.java:652)
	at org.netbeans.modules.debugger.jpda.ui.models.VariablesTreeModelFilter.getValueAt(VariablesTreeModelFilter.java:548)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1464)
	at org.netbeans.modules.debugger.jpda.models.PendingActionsFilter.getValueAt(PendingActionsFilter.java:130)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1464)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1466)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1466)
	at org.netbeans.spi.viewmodel.Models$CompoundModel.getValueAt(Models.java:4591)
[catch] at org.netbeans.modules.viewmodel.TreeModelNode$MyProperty.run(TreeModelNode.java:1916)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Comment 1 Martin Entlicher 2014-08-20 11:43:41 UTC
Reproduced. The problem is, that class java.nio.file.LinkOption[] is not loaded when the expression is evaluated.

I'll try to address the loop of exceptions coming from evaluation of watches and we should probably have a separate issue for the exception dialog that steals the focus.
Comment 2 Martin Entlicher 2014-08-20 13:31:58 UTC
An endless loop of exceptions is fixed by changeset:   277517:daeac3e139e9
http://hg.netbeans.org/core-main/rev/daeac3e139e9
The NPE is fixed by changeset:   277518:ff43519a50c0
http://hg.netbeans.org/core-main/rev/ff43519a50c0

I've submitted issue #246580 for the focus stealing problem, feel free to add comments to it.
Comment 3 Quality Engineering 2014-08-21 02:30:23 UTC
Integrated into 'main-silver', will be available in build *201408210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/daeac3e139e9
User: mentlicher@netbeans.org
Log: #246562: Do not re-evaluate the watch in an endless loop if an exception occurs during the evaluation.
Comment 4 Jiri Kovalsky 2014-08-21 12:04:40 UTC
Product Version: NetBeans IDE Dev (Build 201408210001)
Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b31
System: Linux version 3.13.0-24-generic running on amd64; UTF-8; en_US (nb)

No exception is thrown. Gili, if you still face the problem, please reopen the bug with further details. Thanks.
Comment 5 Martin Entlicher 2014-11-04 16:12:17 UTC
Pushed to release801 release branch:
http://hg.netbeans.org/releases/rev/da76f364446c
http://hg.netbeans.org/releases/rev/0c9b8df18543
Comment 6 Quality Engineering 2014-11-07 16:59:51 UTC
Integrated into 'releases/release801', will be available in build *201411071445* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/da76f364446c
User: mentlicher@netbeans.org
Log: #246562: Do not re-evaluate the watch in an endless loop if an exception occurs during the evaluation.
(transplanted from daeac3e139e9913b551c0dc42ab68c219507320b)
Comment 7 Jiri Kovalsky 2014-11-12 12:41:16 UTC
Product Version: NetBeans IDE 8.0.2 (Build 201411102027)
Java: 1.8.0_25; Java HotSpot(TM) Client VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b18
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
User directory: C:\Users\Jiri Kovalsky\AppData\Roaming\NetBeans\8.0.2
Cache directory: C:\Users\Jiri Kovalsky\AppData\Local\NetBeans\Cache\8.0.2

No exception is being thrown in 8.0.2 update. Verifying.
Comment 8 _ gtzabari 2014-11-12 16:10:46 UTC
So, I looked into this issue and:

    It is reproducible in 8.0.1
    In 8.0.2 I don't get an endless loop but I get: Unknown type "java.nio.file.LinkOption[]"

Based on this, I consider the original bug fixed, but I believe the new message indicates a new bug.

My testcase is simple:

public class Main
{
  public static void main(String[] args)
  {
    Path test = Paths.get("test");
    System.out.println("Add a breakpoint here");
  }
}

then in the breakpoint, add:

  Paths.get(new URI("file://C:/test.jar")).toRealPath()

to the Variables window.

In this case, why can't the IDE resolve java.nio.file.LinkOption[] by itself? It has the fully-qualified name and the class is found on the classpath...