kashiwazakinenji / chromedevtools

Automatically exported from code.google.com/p/chromedevtools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

In Debugger Expressions view crashes on numeric property name #76

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
SDK/Debugger version: 0.3.6
Google Chrome/V8 Embedder + version: Node.JS

What steps will reproduce the problem?
1. In Expressions view add "({ "3302611133": 1,  "8302611133" : 3 })" and have 
it evaluated.
2. Expand properties.

What is the expected result?
2 properties are displayed.

What happens instead?
Expressions view crashes.

Please provide additional information below. If possible, attach a
(reduced) test-case.
java.lang.NumberFormatException: For input string: "3302611133"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:484)
    at java.lang.Integer.valueOf(Integer.java:570)
    at org.chromium.debug.core.model.StackFrame$1.getNameObject(StackFrame.java:228)
    at org.chromium.debug.core.model.StackFrame$1.compare(StackFrame.java:221)
    at org.chromium.debug.core.model.StackFrame$1.compare(StackFrame.java:1)
    at java.util.TimSort.countRunAndMakeAscending(TimSort.java:324)
    at java.util.TimSort.sort(TimSort.java:189)
    at java.util.TimSort.sort(TimSort.java:173)
    at java.util.Arrays.sort(Arrays.java:1347)
    at java.util.Collections.sort(Collections.java:217)
    at org.chromium.debug.core.model.StackFrame.wrapVariables(StackFrame.java:88)
    at org.chromium.debug.core.model.Value.calculateVariables(Value.java:73)
    at org.chromium.debug.core.model.ValueBase$ValueWithLazyVariables.getVariables(ValueBase.java:81)
    at org.eclipse.debug.internal.ui.model.elements.VariableContentProvider.getValueChildren(VariableContentProvider.java:166)
    at org.eclipse.debug.internal.ui.model.elements.ExpressionContentProvider.getAllChildren(ExpressionContentProvider.java:193)
    at org.eclipse.debug.internal.ui.model.elements.VariableContentProvider.getChildCount(VariableContentProvider.java:48)
    at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider.retrieveChildCount(ElementContentProvider.java:114)
    at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider$2.run(ElementContentProvider.java:63)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Original issue reported on code.google.com by peter.ry...@gmail.com on 12 Sep 2012 at 4:42

GoogleCodeExporter commented 8 years ago
Issue 75 has been merged into this issue.

Original comment by peter.ry...@gmail.com on 12 Sep 2012 at 4:57

GoogleCodeExporter commented 8 years ago
See a related issue http://code.google.com/p/chromedevtools/issues/detail?id=77

Original comment by peter.ry...@gmail.com on 12 Sep 2012 at 4:58

GoogleCodeExporter commented 8 years ago
I think, since the "strings" are parsed as [numbers], the object might get 
parsed as array, and the few billion indices between the numbers get assigned 
'undefined' automatically, as this is how arrays internally work (and was the 
reason for using objects in stead of arrays in the first place, which lead to 
my original bugreport).

Original comment by redsandro on 12 Sep 2012 at 7:18

GoogleCodeExporter commented 8 years ago
Sander,
could you please expand your last comment. Particularly, what "parsed as array" 
means.
Peter

Original comment by peter.ry...@gmail.com on 12 Sep 2012 at 9:00

GoogleCodeExporter commented 8 years ago
I have seen this behavior in a NodeJS app I am working on. NodeJS is build on 
V8. In NodeJS/javascript, when you define an array with two big integers as key 
like so:

var ar = [];
ar[1000000000] = 1;
ar[3302611133] = 3;

internally, all keys in between are set in memory like so:

ar[1000000000] = 1;
ar[1000000001] = undefined;
// ...
ar[3302611132] = undefined;
ar[3302611133] = 3;

You won't see this in the Variables Explorer, but memory will fill and the V8 
(nodejs) application will crash.

This looks a lot like what happens if you use an {object} in the way described 
by this bug, as long as you use numbers (as string) that are parsed as integers 
like in bug #77.

Except, this bug with the object only happens in the Variables Explorer or the 
Expressions View in Eclipse, not in the actual NodeJS program. Hence, it feels 
like - on the devtools side of things - the object is internally somehow 
converted to array which causes the crash.

I hope this makes more sense.

Original comment by redsandro on 12 Sep 2012 at 9:47

GoogleCodeExporter commented 8 years ago
As if the Variables panel or Expressions panel run out of reserved memory and 
crash, just like the app does with arrays.

Original comment by redsandro on 12 Sep 2012 at 9:49

GoogleCodeExporter commented 8 years ago
Oh, I see. It's a good guess, but in fact it's unrelated. It's just a slightly 
inaccurate code in Debugger, the fix is ready and soon will be landed: 
http://codereview.chromium.org/10913231/

Original comment by peter.ry...@gmail.com on 13 Sep 2012 at 2:29

GoogleCodeExporter commented 8 years ago
Nice, thanks.

Original comment by redsandro on 13 Sep 2012 at 8:04

GoogleCodeExporter commented 8 years ago
Fixed in HEAD

Original comment by peter.ry...@gmail.com on 19 Sep 2012 at 4:09

GoogleCodeExporter commented 8 years ago
Fixed in 0.3.8

Original comment by peter.ry...@gmail.com on 4 Oct 2012 at 8:33

GoogleCodeExporter commented 8 years ago
Nice!

Original comment by redsandro on 4 Oct 2012 at 9:10