Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart2 vm prints absolute paths to buildtime core library files in stack traces #32087

Closed
mraleph opened this issue Feb 8, 2018 · 2 comments
Closed
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. customer-flutter P2 A bug or feature request we're likely to work on

Comments

@mraleph
Copy link
Member

mraleph commented Feb 8, 2018

Compare this two stack traces obtained by running the same program:

╰─$ xcodebuild/ReleaseX64/dart t/x.dart                                                                                                                                      254 ↵
Unhandled exception:
Error
#0      main.<anonymous closure> (file:///Users/vegorov/src/dart/sdk/t/x.dart:5:36)
#1      _RootZone.runUnary (dart:async/zone.dart:1381)
#2      _FutureListener.handleValue (dart:async/future_impl.dart:129)
#3      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:633)
#4      _Future._propagateToListeners (dart:async/future_impl.dart:662)
#5      _Future._completeWithValue (dart:async/future_impl.dart:477)
#6      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:507)
#7      _microtaskLoop (dart:async/schedule_microtask.dart:41)
#8      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#9      _runPendingImmediateCallback (dart:isolate-patch/dart:isolate/isolate_patch.dart:112)
#10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
╭─ ~/src/dart/sdk ‹master›
╰─$ pkg/vm/tool/dart2 t/x.dart                                                                                                                                               255 ↵
Unhandled exception:
Error
#0      main.<anonymous closure> (file:///Users/vegorov/src/dart/sdk/t/x.dart:5:36)
#1      _RootZone.runUnary (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/zone.dart:1381:54)
#2      _FutureListener.handleValue (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/future_impl.dart:129:18)
#3      _Future._propagateToListeners.handleValueCallback (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/future_impl.dart:633:45)
#4      _Future._propagateToListeners (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/future_impl.dart:662:32)
#5      _Future._completeWithValue (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/future_impl.dart:477:5)
#6      _Future._asyncComplete.<anonymous closure> (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/future_impl.dart:507:7)
#7      _microtaskLoop (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/schedule_microtask.dart:41:21)
#8      _startMicrotaskLoop (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/schedule_microtask.dart:50:5)
#9      _runPendingImmediateCallback (file:///Users/vegorov/src/dart/sdk/runtime/lib/isolate_patch.dart:112:13)
#10     _RawReceivePortImpl._handleMessage (file:///Users/vegorov/src/dart/sdk/runtime/lib/isolate_patch.dart:165:5)

Note that Dart 2 VM emits file URIs pointing to build time locations of core library sources while Dart 1 VM uses dart:... schema: file:///Users/vegorov/src/dart/sdk/sdk/lib/async/zone.dart:1381:54 vs dart:async/zone.dart:1381.

There is code in Flutter that relies on dart: schema uris in the stacktraces to be able to filter and elide some frames: https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/foundation/assertions.dart#L354-L358

So Dart 2 mode fails tests that check if this functionality still working:

test/foundation/stack_trace_test.dart: (2 failures)
test/foundation/error_reporting_test.dart: (6 failures)

We need to come up with the solution for this problem.

@mraleph
Copy link
Member Author

mraleph commented Feb 8, 2018

/cc @peter-ahe-google

@mraleph mraleph added area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. area-front-end Use area-front-end for front end / CFE / kernel format related issues. customer-flutter P1 A high priority bug; for example, a single project is unusable or has many test failures labels Feb 8, 2018
dart-bot pushed a commit that referenced this issue Feb 12, 2018
…ptions.

Currently front-end embeds absolute paths to build time locations into
Kernel binaries. Reporting those to user make stack trace unreadable and
also breaks stack trace filters that attempt to filter out implementation
frames from dart:async:

#1      _RootZone.runUnary (file:///Users/vegorov/src/dart/sdk/sdk/lib/async/zone.dart:1381:54)

same frame in legacy mode looks like this:

#1      _RootZone.runUnary (dart:async/zone.dart:1381)

This CL changes stack frame formatting so that even in Dart 2 mode result looks
closer to legacy mode result.

This is a workaround for #32087

Change-Id: Ic69cb039ff7d40d0e8e5340a9c1dc067427479ea
Reviewed-on: https://dart-review.googlesource.com/40522
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
dart-bot pushed a commit that referenced this issue Feb 22, 2018
While working on #32274 I noticed that #32087 also impacted debugging
experience in the external debuggers like VS Code - IDE attempts to
load non-existent local sources for core libraries, instead of
asking Service for their source.

To resolve this I moved work-around we placed in stack trace formatting
futher up the flow into kernel loader, which will now rewrite urls
for all core library scripts as classes are being created.

Bug: 32087
Change-Id: I2175a041e5fdcc9958bfccb2af724c37c2435f94
Reviewed-on: https://dart-review.googlesource.com/43021
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
@kmillikin kmillikin added this to Triaged in Dart Front End Apr 23, 2018
@kmillikin
Copy link

What does dart:async/zone.dart mean?

Right now only libraries have an import URI in Kernel.

Conceivably this should be fixed in the VM by recognizing dart: libraries from their import URI and maintaining whatever mapping from file URI to import URI you want.

@jensjoha jensjoha added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. customer-flutter P2 A bug or feature request we're likely to work on
Projects
Development

No branches or pull requests

3 participants