Give more context when initializing from dill fails
Previously, if failing when trying to load from a dill it would say
something like
Warning: Tried to initialize from a previous compilation
(build/app.dill), but couldn't. Error message was
'NoSuchMethodError: The method 'getReference' was called on null.
Receiver: null
Tried calling: getReference()'. This might be a bug.
The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.
Which really doesn't give us a lot to go on.
This CL changes that to also give us a little go to on, and report
something like
Warning: Tried to initialize from a previous compilation
(org-dartlang-test:///initializeFrom.dill), but couldn't.
Error message was 'NoSuchMethodError: The method 'getReference' was
called on null.
Receiver: null
Tried calling: getReference()'. Stacktrace included '#0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1 BinaryBuilder.readLibraryReference (package:kernel/binary/ast_from_binary.dart:692:9)
#2 BinaryBuilder.readLibraryDependency (package:kernel/binary/ast_from_binary.dart:837:25)
#3 BinaryBuilder._readLibraryDependencies (package:kernel/binary/ast_from_binary.dart:829:33)
#4 BinaryBuilder.readLibrary (package:kernel/binary/ast_from_binary.dart:803:5)
#5 BinaryBuilder._readOneComponent (package:kernel/binary/ast_from_binary.dart:634:7)
#6 BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:441:7)
#7 IncrementalCompiler.initializeFromDill (package:front_end/src/fasta/incremental_compiler.dart:395:14)
<asynchronous suspension>
#8 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:126:23)
<asynchronous suspension>
#9 CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:46)
#10 new Future.sync (dart:async/future.dart:224:31)
#11 CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:19)
#12 _rootRun (dart:async/zone.dart:1124:13)
#13 _CustomZone.run (dart:async/zone.dart:1021:19)
#14 _runZoned (dart:async/zone.dart:1516:10)
#15 runZoned (dart:async/zone.dart:1463:12)
#16 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:119:12)
#17 IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:108:20)
<asynchronous suspension>
#18 initializedCompile (file:///usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/front_end/test/incremental_load_from_dill_test.dart:397:51)
<asynchronous suspension>
#19 basicTest (file:///usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/front_end/test/incremental_load_from_dill_test.dart:167:34)
<asynchronous suspension>
#20 RunCompilations.run (file:///usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/front_end/test/incremental_load_from_dill_test.dart:101:15)
<asynchronous suspension>
#21 ChainContext.run.doStep.<anonymous closure> (package:testing/src/chain.dart:180:33)
<asynchronous suspension>
#22 new Future.<anonymous closure> (dart:async/future.dart:176:37)
#23 _rootRun (dart:async/zone.dart:1120:38)
#24 _CustomZone.run (dart:async/zone.dart:1021:19)
#25 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#26 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#27 _rootRun (dart:async/zone.dart:1124:13)
#28 _CustomZone.run (dart:async/zone.dart:1021:19)
#29 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#30 Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#31 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#32 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#33 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
'. This might be a bug. The Dart team would greatly appreciate if you would take a moment to report this problem at http://dartbug.com/new.
which will hopefully allow us to actually debug any such reports.
Change-Id: I13bdd4f96c1e4bb2dcce91e533442b48c87c9e0c
Reviewed-on: https://dart-review.googlesource.com/c/85348
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index b16b83e..d62184f 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -4751,12 +4751,16 @@
Message Function(
String string,
String string2,
+ String string3,
Uri
uri_)> templateInitializeFromDillUnknownProblem = const Template<
- Message Function(String string, String string2, Uri uri_)>(
+ Message Function(
+ String string, String string2, String string3, Uri uri_)>(
messageTemplate:
r"""Tried to initialize from a previous compilation (#string), but couldn't.
-Error message was '#string2'. This might be a bug.
+Error message was '#string2'.
+Stacktrace included '#string3'.
+This might be a bug.
The Dart team would greatly appreciate it if you would take a moment to report this problem at http://dartbug.com/new.
If you are comfortable with it, it would improve the chances of fixing any bug if you included the file #uri in your error report, but be aware that this file includes your source code.
@@ -4764,61 +4768,77 @@
withArguments: _withArgumentsInitializeFromDillUnknownProblem);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String string, String string2, Uri uri_)>
- codeInitializeFromDillUnknownProblem =
- const Code<Message Function(String string, String string2, Uri uri_)>(
+const Code<
+ Message Function(
+ String string, String string2, String string3, Uri uri_)>
+ codeInitializeFromDillUnknownProblem = const Code<
+ Message Function(
+ String string, String string2, String string3, Uri uri_)>(
"InitializeFromDillUnknownProblem",
templateInitializeFromDillUnknownProblem,
severity: Severity.warning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsInitializeFromDillUnknownProblem(
- String string, String string2, Uri uri_) {
+ String string, String string2, String string3, Uri uri_) {
if (string.isEmpty) throw 'No string provided';
if (string2.isEmpty) throw 'No string provided';
+ if (string3.isEmpty) throw 'No string provided';
String uri = relativizeUri(uri_);
return new Message(codeInitializeFromDillUnknownProblem,
message:
"""Tried to initialize from a previous compilation (${string}), but couldn't.
-Error message was '${string2}'. This might be a bug.
+Error message was '${string2}'.
+Stacktrace included '${string3}'.
+This might be a bug.
The Dart team would greatly appreciate it if you would take a moment to report this problem at http://dartbug.com/new.
If you are comfortable with it, it would improve the chances of fixing any bug if you included the file ${uri} in your error report, but be aware that this file includes your source code.
Either way, you should probably delete the file so it doesn't use unnecessary disk space.""",
- arguments: {'string': string, 'string2': string2, 'uri': uri_});
+ arguments: {
+ 'string': string,
+ 'string2': string2,
+ 'string3': string3,
+ 'uri': uri_
+ });
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(String string, String string2)>
- templateInitializeFromDillUnknownProblemNoDump =
- const Template<Message Function(String string, String string2)>(
+const Template<Message Function(String string, String string2, String string3)>
+ templateInitializeFromDillUnknownProblemNoDump = const Template<
+ Message Function(String string, String string2, String string3)>(
messageTemplate:
r"""Tried to initialize from a previous compilation (#string), but couldn't.
-Error message was '#string2'. This might be a bug.
+Error message was '#string2'.
+Stacktrace included '#string3'.
+This might be a bug.
The Dart team would greatly appreciate it if you would take a moment to report this problem at http://dartbug.com/new.""",
withArguments: _withArgumentsInitializeFromDillUnknownProblemNoDump);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String string, String string2)>
+const Code<Message Function(String string, String string2, String string3)>
codeInitializeFromDillUnknownProblemNoDump =
- const Code<Message Function(String string, String string2)>(
+ const Code<Message Function(String string, String string2, String string3)>(
"InitializeFromDillUnknownProblemNoDump",
templateInitializeFromDillUnknownProblemNoDump,
severity: Severity.warning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsInitializeFromDillUnknownProblemNoDump(
- String string, String string2) {
+ String string, String string2, String string3) {
if (string.isEmpty) throw 'No string provided';
if (string2.isEmpty) throw 'No string provided';
+ if (string3.isEmpty) throw 'No string provided';
return new Message(codeInitializeFromDillUnknownProblemNoDump,
message:
"""Tried to initialize from a previous compilation (${string}), but couldn't.
-Error message was '${string2}'. This might be a bug.
+Error message was '${string2}'.
+Stacktrace included '${string3}'.
+This might be a bug.
The Dart team would greatly appreciate it if you would take a moment to report this problem at http://dartbug.com/new.""",
- arguments: {'string': string, 'string2': string2});
+ arguments: {'string': string, 'string2': string2, 'string3': string3});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 98179f2..5192935 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -131,7 +131,7 @@
if (initializeFromDillUri != null) {
try {
bytesLength += await initializeFromDill(uriTranslator, c, data);
- } catch (e) {
+ } catch (e, st) {
// We might have loaded x out of y libraries into the component.
// To avoid any unforeseen problems start over.
bytesLength = prepareSummary(summaryBytes, uriTranslator, c, data);
@@ -159,9 +159,11 @@
? templateInitializeFromDillUnknownProblem.withArguments(
initializeFromDillUri.toString(),
"$e",
+ "$st",
gzInitializedFrom)
: templateInitializeFromDillUnknownProblemNoDump
- .withArguments(initializeFromDillUri.toString(), "$e");
+ .withArguments(
+ initializeFromDillUri.toString(), "$e", "$st");
dillLoadedData.loader
.addProblem(message, TreeNode.noOffset, 1, null);
}
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 198c6d3..9dc289a 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -3010,7 +3010,9 @@
InitializeFromDillUnknownProblem:
template: |
Tried to initialize from a previous compilation (#string), but couldn't.
- Error message was '#string2'. This might be a bug.
+ Error message was '#string2'.
+ Stacktrace included '#string3'.
+ This might be a bug.
The Dart team would greatly appreciate it if you would take a moment to report this problem at http://dartbug.com/new.
If you are comfortable with it, it would improve the chances of fixing any bug if you included the file #uri in your error report, but be aware that this file includes your source code.
@@ -3023,7 +3025,9 @@
InitializeFromDillUnknownProblemNoDump:
template: |
Tried to initialize from a previous compilation (#string), but couldn't.
- Error message was '#string2'. This might be a bug.
+ Error message was '#string2'.
+ Stacktrace included '#string3'.
+ This might be a bug.
The Dart team would greatly appreciate it if you would take a moment to report this problem at http://dartbug.com/new.