Skip to content

Stack frame parser is crashing with malformed asynchronous gap lines #59893

Description

@pingbird

Description

When running tests, exceptional behavior sometimes causes the diagnostics to crash with an exception similar to the following:

══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test:
Expected ===== asynchronous gap =========================== to match RegExp: pattern=^(.+)
(\d+):(\d+)\s+(.+)$ flags=.
'package:flutter/src/foundation/stack_frame.dart':
Failed assertion: line 115 pos 12: 'match != null'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=BUG.md

When the exception was thrown, this was the stack:
#2      StackFrame._parseWebDebugFrame (package:flutter/src/foundation/stack_frame.dart:115:12)
#3      StackFrame._parseWebFrame (package:flutter/src/foundation/stack_frame.dart:101:14)
#4      StackFrame.fromStackTraceLine (package:flutter/src/foundation/stack_frame.dart:195:14)
#5      MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
#6      ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
#7      SkipWhileIterator.moveNext (dart:_internal/iterable.dart:680:22)
#8      new List.from (dart:core-patch/array_patch.dart:50:19)
#9      new List.of (dart:core-patch/array_patch.dart:68:17)
#10     Iterable.toList (dart:core/iterable.dart:404:12)
#11     StackFrame.fromStackString (package:flutter/src/foundation/stack_frame.dart:96:10)
#12     FlutterError.defaultStackFilter (package:flutter/src/foundation/assertions.dart:945:54)
#13     new DiagnosticsStackTrace (package:flutter/src/foundation/assertions.dart:1088:59)
#14     FlutterErrorDetails.debugFillProperties (package:flutter/src/foundation/assertions.dart:650:22)
#15     DiagnosticableNode.builder.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:2944:18)
#16     DiagnosticableNode.builder (package:flutter/src/foundation/diagnostics.dart:2947:8)
#17     _FlutterErrorDetailsNode.builder (package:flutter/src/foundation/assertions.dart:1126:55)
#18     DiagnosticableNode.getProperties (package:flutter/src/foundation/diagnostics.dart:2961:105)
#19     TextTreeRenderer._debugRender (package:flutter/src/foundation/diagnostics.dart:1250:63)
#20     TextTreeRenderer.render (package:flutter/src/foundation/diagnostics.dart:1128:14)
#21     FlutterError.dumpErrorToConsole (package:flutter/src/foundation/assertions.dart:900:11)
#22     TestWidgetsFlutterBinding._runTest.<anonymous closure> (package:flutter_test/src/binding.dart:618:24)
#23     FlutterError.reportError (package:flutter/src/foundation/assertions.dart:1032:14)
#24     TestWidgetsFlutterBinding._runTest.handleUncaughtError (package:flutter_test/src/binding.dart:690:20)
#25     TestWidgetsFlutterBinding._runTest.<anonymous closure> (package:flutter_test/src/binding.dart:714:28)
#30     TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart)

This crash can be reproduced with the following test:

  testWidgets('async gap', (tester) async {
    final ctrl = Completer<String>();

    ctrl.future.then((value) {}, onError: (dynamic err, StackTrace bt) {
      FlutterError.reportError(FlutterErrorDetails(
        exception: err,
        stack: bt,
      ));
    });

    ctrl.completeError('Test');
  });

Version

Flutter 1.20.0-1.0.pre • channel master • https://github.com/flutter/flutter
Framework • revision 401690a64f (7 days ago) • 2020-06-12 19:45:48 -0700
Engine • revision 965fbbed17
Tools • Dart 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)

Metadata

Metadata

Assignees

Labels

a: tests"flutter test", flutter_test, or one of our testsframeworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions