Skip to content

Fix incorrect build due to racy builder changes.#4988

Open
davidmorgan wants to merge 1 commit into
dart-lang:masterfrom
davidmorgan:fix-racy-builders
Open

Fix incorrect build due to racy builder changes.#4988
davidmorgan wants to merge 1 commit into
dart-lang:masterfrom
davidmorgan:fix-racy-builders

Conversation

@davidmorgan

@davidmorgan davidmorgan commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Fix #4986.

Checking for changes to builder code is done using digests computed after the compile.

This causes a problem if files change during the compile: we don't know if the compiler used the same version of the file that was digested.

Fix this by adding a "stamp" file that records when the compile started, then using the stamp file and the digest file timestamps to check for files modified during the compile.

Add platform-specific code for getting higher-resolution-than-available-with-the-Dart-SDK timestamps so this check won't cause too many false positives.

This seems like a lot of complexity for an issue that won't happen very often; but rebuilding correctly is core build_runner functionality, and better handling of mtimes is something we might want to use for other things. So it seems worth a try.

On Windows, include some additional args in PowerShell calls that Gemini thought were a good idea, and some googling confirmed they seem to be recommended for this type of use case.

@github-actions

Copy link
Copy Markdown

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

@davidmorgan davidmorgan force-pushed the fix-racy-builders branch 8 times, most recently from c26c74d to 84ffc77 Compare July 6, 2026 11:09
Hybrid digest and mtime check

fix: Detect builder source changes during compile

Closes dart-lang#4986
@davidmorgan davidmorgan marked this pull request as ready for review July 6, 2026 12:36
@davidmorgan davidmorgan requested a review from jensjoha July 6, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition in watch mode when changing the source of a builder

1 participant