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 212619 - Warn user when there are slow types to evaluation in the list of variables/watches
Summary: Warn user when there are slow types to evaluation in the list of variables/wa...
Status: RESOLVED INVALID
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.2
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks: 204645
  Show dependency tree
 
Reported: 2012-05-17 09:07 UTC by Jaroslav Tulach
Modified: 2016-05-25 06:14 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2012-05-17 09:07:24 UTC
I am trying to fix bug 204645, but whenever I try to debug the problem, the debugger becomes stuck in evaluation of various variables and watches and becomes unusuable.

The bug 204645 is about having 10000 files in a folder and trying to select them in a favorites tab. This causes deep recursion.

I have modified DataNode.java method to stop when the recursion is at least 300 stack frames:

      public void beforeLookup(Class<?> clazz) {
            if (clazz.isAssignableFrom(FileObject.class)) {
                Exception e = new Exception();
                final int len = e.getStackTrace().length;
                System.err.println("depth: " + len);
                if (len > 300) {
                    System.err.println("too deep");
                }
                updateFilesInCookieSet(obj.files());
            }
        }
    }

and I put breakpoint on the System.err line. When the debugger is stopped, I am trying to inspect individual occurences of ProxyLookup.R.computeResult. Soon, the debugger stops being responsive.
Comment 1 Martin Entlicher 2012-05-17 13:48:27 UTC
I've reproduced that.
At first sight it looks to me like the loop that is causing stack overflow is somehow continuing during the evaluation...
Comment 2 Jaroslav Tulach 2012-05-18 14:44:59 UTC
Intersting. And yes, toString() might trigger it.
Comment 3 Martin Entlicher 2012-05-18 15:04:54 UTC
I do not think I can do something particular about it. The debugger simply needs to be customized so that it does not call any method that takes long time to execute (or does not finish at all).
Many frames are in ProxyLookup$LazyCollection or ProxyLookup$LazyList.
Since this implements List interface, debugger tries to show it's size. This triggers the loop, therefore you need to press "Open Formatters Options" button on the left side of the Variables window and uncheck "Default Collection Formatter".
Since LazyCollection.toString() calls delegate(), which triggers the loop, you need to prevent from that and remove the toString() column as well as assure that the "$" button in unchecked.
Comment 4 Jaroslav Tulach 2012-05-22 16:24:31 UTC
Can you detect that an evalution (of certain type) takes too long and offer the user to disable it? That would be nice improvement, as otherwise it is hard for users to understand what is going on.


Possibly you replace the "evaluating..." text in the variable field with something like "click to evalute..." for these slow types.