Issue 15171 in dart: dart2js errors have stack traces that don't remain identical over time.

6 views
Skip to first unread message

da...@googlecode.com

unread,
Nov 19, 2013, 2:44:38 PM11/19/13
to bu...@dartlang.org
Status: Triaged
Owner: ----
Labels: Type-Defect Priority-Unassigned Area-Dart2JS

New issue 15171 by nw...@google.com: dart2js errors have stack traces that
don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

Consider the following code:

var st1;
try {
try {
throw 'bad';
} catch (e, st) {
st1 = st;
rethrow;
}
} catch (e, st2) {
print(st1 == st2);
print(identical(st1, st2));
}

On the VM, this prints "true" and "true", but on dart2js it prints "false"
and "false". This makes it difficult to compare stack traces for equality
and impossible to use them in expandos, which is blocking my work on issue
7040 on dart2js.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

da...@googlecode.com

unread,
Nov 19, 2013, 4:29:10 PM11/19/13
to bu...@dartlang.org
Updates:
Status: Started
Owner: a...@google.com

Comment #1 on issue 15171 by a...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

Nathan,

Try this patch:

diff --git a/dart/sdk/lib/_internal/lib/js_helper.dart
b/dart/sdk/lib/_internal/lib/js_helper.dart
index 2e350b7..7cba4fd 100644
--- a/dart/sdk/lib/_internal/lib/js_helper.dart
+++ b/dart/sdk/lib/_internal/lib/js_helper.dart
@@ -1419,7 +1419,12 @@ unwrapException(ex) {
* Called by generated code to fetch the stack trace from an
* exception. Should never return null.
*/
-StackTrace getTraceFromException(exception) => new _StackTrace(exception);
+StackTrace getTraceFromException(exception) {
+ _StackTrace trace = JS('_StackTrace|Null', r'#.$cachedTrace', exception);
+ if (trace != null) return trace;
+ trace = new _StackTrace(exception);
+ return JS('_StackTrace', r'#.$cachedTrace = #', exception, trace);
+}

class _StackTrace implements StackTrace {
var _exception;

I'm at home without VPN right now, but I'll try to get this submitted
tomorrow.

Cheers,
Peter

da...@googlecode.com

unread,
Nov 19, 2013, 4:56:57 PM11/19/13
to bu...@dartlang.org

Comment #2 on issue 15171 by nw...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

That works great, thanks!

da...@googlecode.com

unread,
Nov 20, 2013, 8:04:10 AM11/20/13
to bu...@dartlang.org

Comment #3 on issue 15171 by a...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

https://codereview.chromium.org/78343002

da...@googlecode.com

unread,
Apr 11, 2014, 1:38:29 PM4/11/14
to bu...@dartlang.org

Comment #4 on issue 15171 by efor...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

I'd like to cast a vote in support of getting this CL in!

da...@googlecode.com

unread,
Apr 16, 2014, 5:25:58 PM4/16/14
to bu...@dartlang.org

Comment #5 on issue 15171 by seth...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

What's the priority?

da...@googlecode.com

unread,
Apr 16, 2014, 5:59:04 PM4/16/14
to bu...@dartlang.org

Comment #6 on issue 15171 by nw...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

I'd certainly like to see this patch land, but it's not blocking me
personally since I don't do any debugging in the browser.

da...@googlecode.com

unread,
Apr 17, 2014, 3:24:15 AM4/17/14
to bu...@dartlang.org

Comment #7 on issue 15171 by a...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

The CL https://codereview.chromium.org/78343002 has met surprising
resistance from the VM team. So I'm stuck.

da...@googlecode.com

unread,
Apr 17, 2014, 12:08:56 PM4/17/14
to bu...@dartlang.org

Comment #8 on issue 15171 by efor...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

Peter, you mention on the code review that the language team would discuss
to come to a decision. Do we know if they did?

da...@googlecode.com

unread,
Apr 17, 2014, 3:29:17 PM4/17/14
to bu...@dartlang.org

Comment #9 on issue 15171 by nw...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

The objection to CL 78343002 seems to be that this isn't a guarantee we
want to offer, but this guarantee is crucial to making stack chain tracking
work. I contend that breaking stack chains is an unacceptable usability
regression, so we should commit to guaranteeing identity equality of stack
traces.

da...@googlecode.com

unread,
Apr 17, 2014, 4:08:18 PM4/17/14
to bu...@dartlang.org

Comment #10 on issue 15171 by a...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

I agree with Nathan.

Emily: I not sure those meetings exist anymore.

da...@googlecode.com

unread,
Apr 17, 2014, 4:34:20 PM4/17/14
to bu...@dartlang.org

Comment #11 on issue 15171 by efor...@google.com: dart2js errors have
stack traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

@Peter, yes, but I'm curious if it was actually discussed back when they
did.

da...@googlecode.com

unread,
Apr 17, 2014, 4:47:38 PM4/17/14
to bu...@dartlang.org

Comment #12 on issue 15171 by a...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

I don't think it was ever discussed. I don't recall seeing anything about
it in Bob's minutes.

da...@googlecode.com

unread,
Apr 23, 2014, 6:08:56 AM4/23/14
to bu...@dartlang.org
Updates:
Blockedon: dart:18394

Comment #13 on issue 15171 by kas...@google.com: dart2js errors have stack
traces that don't remain identical over time.
http://code.google.com/p/dart/issues/detail?id=15171

(No comment was entered for this change.)

da...@googlecode.com

unread,
Jun 2, 2015, 12:24:50 PM6/2/15
to bu...@dartlang.org
Updates:
Owner: sig...@google.com
Cc: a...@google.com

Comment #14 on issue 15171 by sig...@google.com: dart2js errors have stack
traces that don't remain identical over time.
https://code.google.com/p/dart/issues/detail?id=15171

I hope that we will agree on guaranteeing that the stacktraces are
identical (I just pinged issue 18394 to follow up on that).

Regardless of that discussion, I'd like to push forward the change Peter
proposed earlier. Doing so will make it easier for people to debug async
stack traces, and it will make the dart2js consistent with the current VM
behavior.

If and when we decide that we don't want those guarantees and the VM needs
to change the behavior in the future, we can revisit this at that point.

da...@googlecode.com

unread,
Jun 2, 2015, 12:31:32 PM6/2/15
to bu...@dartlang.org

Comment #15 on issue 15171 by sig...@google.com: dart2js errors have stack
traces that don't remain identical over time.
https://code.google.com/p/dart/issues/detail?id=15171

just sent out https://codereview.chromium.org/1152023004/

da...@googlecode.com

unread,
Jun 2, 2015, 5:02:45 PM6/2/15
to bu...@dartlang.org

Comment #16 on issue 15171 by sig...@google.com: dart2js errors have stack
traces that don't remain identical over time.
https://code.google.com/p/dart/issues/detail?id=15171

Looks like the new language in the spec actually now requires that rethrow
gives you the same stack trace object (see discussion in issue 18394), so
we should be good to go.
Reply all
Reply to author
Forward
0 new messages