Skip to content

Fix repo deletion test flake - #195349

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
justinmc:windows-file-system-flakes
Oct 27, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
justinmc:windows-file-system-flakes

Conversation

@justinmc

Copy link
Copy Markdown
Contributor

Some tests have flaked because of a failed recursive directory deletion, for example in this run's output:

00:02 +69 ~2 -1: /b/s/w/ir/x/w/flutter/dev/tools/test/last_engine_commit_test.dart: if there have been no engine changes, uses the first commit since the branch point [E]
  FileSystemException: Deletion failed, path = '/b/s/w/ir/x/t/last_engine_commit_test.SDNXWC' (OS Error: Directory not empty, errno = 39)
  dart:io                                                               FileSystemEntity.deleteSync
  package:file/src/forwarding/forwarding_file_system_entity.dart 70:16  ForwardingFileSystemEntity.deleteSync
  test/last_engine_commit_test.dart 124:12                              main.<fn>

A likely cause is that git is making changes to the filesystem in the background, so I've disabled detached mode for git. I also made it retry the deletion if it fails.

I wasn't able to repro locally, so I won't close the issue until I can confirm that the flake doesn't happen again.

Related to: #194368

@justinmc justinmc self-assigned this Oct 26, 2026
@justinmc
justinmc requested a review from jtmcdole as a code owner October 26, 2026 19:47
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 26, 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 introduces a utility file temp_git_repo_utils.dart to disable Git's automatic maintenance and garbage collection during tests, and provides a retrying directory deletion helper deleteTempDirectory. Tests in content_aware_hash_test.dart, last_engine_commit_test.dart, and update_engine_version_test.dart are updated to use these utilities. Feedback suggests refactoring deleteTempDirectory to use asynchronous file system operations (exists and delete) instead of synchronous ones to prevent blocking the Dart event loop.

Comment on lines +39 to +41
if (directory.existsSync()) {
directory.deleteSync(recursive: true);
}

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.

medium

Since deleteTempDirectory is an asynchronous function returning a Future, it is highly recommended to use the asynchronous exists() and delete(recursive: true) methods instead of their synchronous counterparts (existsSync and deleteSync). This prevents blocking the Dart event loop during I/O operations.

Suggested change
if (directory.existsSync()) {
directory.deleteSync(recursive: true);
}
if (await directory.exists()) {
await directory.delete(recursive: true);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I lean towards keeping this as-is since it's consistent with the rest of these tests. This runs in test teardown so blocking the event loop is not problematic.

Happy to change it if a reviewer thinks it would be better, though.

chunhtai
chunhtai previously approved these changes Oct 26, 2026

@chunhtai chunhtai 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.

LGTM, just a suggestion.

'GIT_CONFIG_KEY_0': 'maintenance.auto',
'GIT_CONFIG_VALUE_0': 'false',
'GIT_CONFIG_KEY_1': 'gc.auto',
'GIT_CONFIG_VALUE_1': '0',

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.

maybe also add a

  'GIT_CONFIG_KEY_2': 'gc.autoDetach',
  'GIT_CONFIG_VALUE_2': 'false',

Comment thread dev/tools/test/temp_git_repo_utils.dart Outdated
/// also covers repositories and `git` commands created by the scripts under
/// test. Requires Git 2.31 or newer.
const Map<String, String> kDisableGitAutoMaintenanceEnvironment = <String, String>{
'GIT_CONFIG_COUNT': '2',

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.

change to 3 if adding a new one

@Piinks Piinks added the framework flutter/packages/flutter repository. See also f: labels. label Oct 26, 2026
@github-actions github-actions Bot removed the framework flutter/packages/flutter repository. See also f: labels. label Oct 26, 2026
@justinmc
justinmc requested a review from chunhtai October 26, 2026 23:08

@chunhtai chunhtai 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.

LGTM

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 27, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into flutter:master with commit aebd23e Oct 27, 2026
22 of 23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 27, 2026
@justinmc
justinmc deleted the windows-file-system-flakes branch October 27, 2026 18:58
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 28, 2026
flutter/flutter@d4c8577...0c2473c

2026-10-28 [email protected] Roll Packages from a8549ae to 13d38e0 (9 revisions) (flutter/flutter#195488)
2026-10-28 [email protected] Use int.oneBitCount in PersistentHashMap and scope 53-bit caps to JS (flutter/flutter#195005)
2026-10-28 [email protected] Roll pub packages (flutter/flutter#195483)
2026-10-28 [email protected] [iPhone Duo] Use the correct UIScreen to report the display size and update when fold/unfold (flutter/flutter#195199)
2026-10-28 [email protected] [fuchsia] Fix portable_ui_test.h includes for newer Fuchsia SDKs (flutter/flutter#195420)
2026-10-28 [email protected] Change default pipeline options to match production draw calls (flutter/flutter#194597)
2026-10-28 [email protected] Roll Fuchsia Test Scripts from 2T18KC7-LDQtmQiLP... to xl1LWBuppzu-BnOzV... (flutter/flutter#195450)
2026-10-27 [email protected] [flutter_tools] Inject dependencies into Darwin build targets, native assets, and Xcode build settings (flutter/flutter#194052)
2026-10-27 [email protected] Revert: Reland square corners fix (flutter/flutter#195436)
2026-10-27 [email protected] [flutter_tools] Add DeviceService app launch and flutter run support for tool extensions (flutter/flutter#194589)
2026-10-27 [email protected] [engine] Honor targetWidth/targetHeight for animated images (flutter/flutter#194615)
2026-10-27 [email protected] [Android][a11y] Set visibleToUser=false for hidden semantics nodes (flutter/flutter#194411)
2026-10-27 [email protected] Fix repo deletion test flake (flutter/flutter#195349)
2026-10-27 [email protected] Roll Packages from 23a05b6 to a8549ae (10 revisions) (flutter/flutter#195434)
2026-10-27 [email protected] [web] Capture pointers to the Flutter view so drags survive platform view iframes (flutter/flutter#195187)
2026-10-27 [email protected] [web] Add opt-in raw samples, measured sample count and warm-up phase hook to the web benchmark recorder (flutter/flutter#195118)
2026-10-27 [email protected] Link migration guide in deprecation messages (flutter/flutter#195361)
2026-10-27 [email protected] Pin basic_material_app_macos__compile to macOS 26 (flutter/flutter#195429)
2026-10-27 [email protected] Add benchmark for warmed pipeline usage (flutter/flutter#195001)
2026-10-27 [email protected] [flutter_tools] Add device log streaming support to DeviceService and ExtensionBackedDevice (flutter/flutter#194964)
2026-10-27 [email protected] Roll Dart SDK from 1d16c04dc346 to 65fc979759ca (4 revisions) (flutter/flutter#195383)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
Some tests have flaked because of a failed recursive directory deletion,
for example in [this run's
output](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8668009021583785713/+/u/run_test.dart_for_framework_tests_shard_and_subshard_misc/stdout):

```
00:02 +69 ~2 -1: /b/s/w/ir/x/w/flutter/dev/tools/test/last_engine_commit_test.dart: if there have been no engine changes, uses the first commit since the branch point [E]
  FileSystemException: Deletion failed, path = '/b/s/w/ir/x/t/last_engine_commit_test.SDNXWC' (OS Error: Directory not empty, errno = 39)
  dart:io                                                               FileSystemEntity.deleteSync
  package:file/src/forwarding/forwarding_file_system_entity.dart 70:16  ForwardingFileSystemEntity.deleteSync
  test/last_engine_commit_test.dart 124:12                              main.<fn>
```

A likely cause is that git is making changes to the filesystem in the
background, so I've disabled detached mode for git. I also made it retry
the deletion if it fails.

I wasn't able to repro locally, so I won't close the issue until I can
confirm that the flake doesn't happen again.

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

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants