Skip to content

[flutter_tools] Add retry and timeout to getFlutterWidgetPreviews in LspPreviewDetector - #190929

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
bkonyi:issue-189496
Aug 11, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
bkonyi:issue-189496

Conversation

@bkonyi

@bkonyi bkonyi commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Addresses flakiness in tool_integration_tests by adding a 5-second timeout and up to 5 retries (with 200ms delay) when calling dtd.getFlutterWidgetPreviews(). This handles transient crashes/hangs of the Analysis Server during test execution.

Also improves diagnostics in widget_preview_test_helpers.dart by closing the stdout stream controller onDone and logging the exit code of the widget-preview process.

Aborts retries early if the detector is disposed or the tool is shutting down to prevent hangs.

Fixes #189496

Pre-launch Checklist

…LspPreviewDetector

Addresses flakiness in tool_integration_tests by adding a 5-second timeout
and up to 5 retries (with 200ms delay) when calling
`dtd.getFlutterWidgetPreviews()`. This handles transient crashes/hangs of
the Analysis Server during test execution.

Also improves diagnostics in `widget_preview_test_helpers.dart` by closing
the stdout stream controller `onDone` and logging the exit code of the
`widget-preview` process.

Aborts retries early if the detector is disposed or the tool is shutting down
to prevent hangs.
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 11, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for logging LSP traffic and implements a retry mechanism with a timeout when retrieving widget previews from the Dart Tooling Daemon (DTD). It also updates integration test helpers to close the stdout stream controller upon completion. Feedback suggests removing the waitForAnalysis() call from within the retry loop to prevent potential hangs and unhandled exceptions.

Comment thread packages/flutter_tools/lib/src/widget_preview/lsp_preview_detector.dart Outdated
@bkonyi
bkonyi requested a review from srawlins August 11, 2026 16:03
srawlins
srawlins previously approved these changes Aug 11, 2026
Comment thread packages/flutter_tools/lib/src/widget_preview/lsp_preview_detector.dart Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit

auto-submit Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/190929, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 11, 2026
Merged via the queue into flutter:master with commit 2132595 Aug 11, 2026
27 of 28 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux tool_integration_tests_4_7 is 3.06% flaky

2 participants