Skip to content

Fix race causing null dereference on getStack in web_tool_tests and CI flakes - #87278

Merged
fluttergithubbot merged 2 commits into
flutter:masterfrom
annagrin:annagrin/eval_test_race_get_stack
Jul 29, 2021
Merged

fluttergithubbot merged 2 commits into
flutter:masterfrom
annagrin:annagrin/eval_test_race_get_stack

Conversation

@annagrin

Copy link
Copy Markdown
Contributor

One case of recent CI flakes in web_tool_tests was caused by a race condition between resuming
an isolate and waiting for the app to hit a next breakpoint. If resume gets delayed in the vm service,
the tests might get a stale "paused" state of the isolate and call getStack while running, which
causes an exception in dwds, which is limited by chrome dev tools capabilities in that case and
cannot get a stack while running.

Fix the race condition by waiting for Resume event before waiting for Pause in TestDriver._resume.

Following PR changes the null dereference to an RPCError in dwds if getStack while the app is running.

Related: dart-lang/webdev#1370

Closes: dart-lang/webdev#1369

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Anna Gringauze added 2 commits July 28, 2021 18:27
Race was happening when a test exited before the future in expectLater
completed, causing next test to race with it.

Closes:
One case of recent CI flakes in web_tool_tests was caused by
a race condition between resuming an isolate and waiting for
the app to hit a next breakpoint. If resume gets delayed in
the vm service, the tests might get a stale "paused" state of
the isolate and call `getStack` while running, which causes
an exception in dwds, which is limited by chrome dev tools
capabilities in that case and cannot get a stack while running.

Fix the race condition by waiting for `Resume` event before
waiting for `Pause` in `TestDriver._resume`.

Following PR changes the null dereference to an RPCError
in dwds if `getStack` while the app is running.

Related: dart-lang/webdev#1370

Closes: dart-lang/webdev#1369
@flutter-dashboard flutter-dashboard Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jul 29, 2021
@google-cla google-cla Bot added the cla: yes label Jul 29, 2021
@fluttergithubbot
fluttergithubbot merged commit 33fd4f1 into flutter:master Jul 29, 2021
annagrin pushed a commit to annagrin/flutter that referenced this pull request Aug 17, 2021
Subscribe to events before sending commands to VM that trigger
the event in question, to prevent a race where the event arrives
before subscription.

Previous fix for another race condition exposed the current issue:
Related: flutter#87278
Related: dart-lang/webdev#1369

Closes:flutter#87481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter CI flakes: getStack: (-32603) getStack: NoSuchMethodError: The method 'toJson' was called on null.

3 participants