-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Shortened stack trace from VM #44169
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
Comments
I've tried reproducing this, but patching 168485 onto 95e4e03 has given me no exceptions in the hour or so I've let it run now. (It appears to be an infinite loop?) @jensjoha, do you have a reproducing example I can try, or has something changed in the meantime? As for the issue described, it is suspicious that you're seeing two gaps at the end of the trace, though I don't currently have a good guess how that could happen. |
And yes, it's an infinite loop, but it crashes up front (when it crashes). The above is verified (on my machine at least):
|
Gotcha. I'll give that a try. Thanks, Jens! |
I've narrowed it down to:
Which I've boiled down to this: void clear() => 'Does nothing';
myAction() async {
await 0;
throw 'async throw from myAction.';
}
// `myaction` is run immediately in Future.sync, eventually throws, which is then
// being passed on to the internals of whenComplete, which runs `clear` and
// rethrows from there.
doThings() async => Future.sync(() => myAction()).whenComplete(clear);
main() async => await doThings(); So when we try do the stack unwinding we have:
And from there we run out of chain to lazily unwind, hence the short stack with --lazy-async-stack. @mkustermann, do you see anything we can do about this? |
@jensjoha The code in the frontend uses diff --git a/pkg/front_end/lib/src/fasta/compiler_context.dart b/pkg/front_end/lib/src/fasta/compiler_context.dart
index e64cd29900e..fffd1ac7817 100644
--- a/pkg/front_end/lib/src/fasta/compiler_context.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_context.dart
@@ -120,9 +120,13 @@ class CompilerContext {
/// Perform [action] in a [Zone] where [this] will be available as
/// `CompilerContext.current`.
Future<T> runInContext<T>(Future<T> action(CompilerContext c)) {
- return runZoned(
- () => new Future<T>.sync(() => action(this)).whenComplete(clear),
- zoneValues: {compilerContextKey: this});
+ return runZoned(() async {
+ try {
+ await action(this);
+ } finally {
+ clear();
+ }
+ }, zoneValues: {compilerContextKey: this});
} in the frontend package? @cskau-g One action item we should definitely take here is that we should avoid emitting consecutive We could consider writing Alternatively we could make VM use |
TEST=tools/test.py -n dartk-linux-release-x64 vm/dart_2/causal_stacks Bug: #44169 Change-Id: I27dbe298ea30ef562984788223080fcb65f43da4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172961 Reviewed-by: Tess Strickland <[email protected]> Commit-Queue: Clement Skau <[email protected]>
Done: https://dart-review.googlesource.com/c/sdk/+/172961
I will follow up on this. |
TEST=tools/test.py -n dartk-linux-release-x64 vm/dart_2/causal_stacks Bug: #44169 Change-Id: Ia5810ca3585f8e90b6fb91827a892a038e82f13b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173264 Commit-Queue: Clement Skau <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
Done: https://dart-review.googlesource.com/c/sdk/+/173264 That should address all the VM concerns for this issue. I'll reassign to you, @jensjoha, to decide if you folks want to follow up on Martin's suggestion in #44169 (comment). |
Reintroducing the crash I now get
which seems fine =) |
Uh oh!
There was an error while loading. Please reload this page.
With CL https://dart-review.googlesource.com/c/sdk/+/168485/9 (on top of what it's on top of, i.e. 42ac762) it crashes when loading the dill file (obviously it shouldn't, I'll look into that separately) if you run for instance
out/ReleaseX64/dart pkg/front_end/test/constant_evaluator_benchmark.dart --platform=out/ReleaseX64/dart-sdk/lib/_internal/dart2js_platform.dill pkg/compiler/bin/dart2js.dart --target=dart2js --nnbd
like this:which is missing something at the end... e.g. which line in
constant_evaluator_benchmark.dart
actually came to this path?If I add
--no-lazy-async-stacks --causal-async-stacks
I instead getwhich gives me my answer, so I assume the shortened stacktrace is a bug with the lazy async stuff.
/cc @cskau-g
The text was updated successfully, but these errors were encountered: