Skip to content

fix: purge restored Burst cache in Cloud Build PreExport#8966

Draft
aixaCode wants to merge 1 commit into
devfrom
fix/purge-burst-cache-cloud-build
Draft

fix: purge restored Burst cache in Cloud Build PreExport#8966
aixaCode wants to merge 1 commit into
devfrom
fix/purge-burst-cache-cloud-build

Conversation

@aixaCode

Copy link
Copy Markdown
Collaborator

Pull Request Description

What does this PR change?

Windows Cloud Builds have been failing intermittently (24/55 runs on Jun 10) with:

Burst compiler failed running
Error: Failed to find entry-points:
System.Exception: Error while loading assembly references for AppArgs
  ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
  at Burst.Compiler.IL.Hashing.Storage.ILHashingResultRuntime.GetHeader(String hashCachePath)

The Library cache restored by Unity Cloud Build contains truncated Burst hash-cache files — most likely from builds cancelled mid-cache-write (our cancel-in-progress cancels in-flight Cloud Builds on every push). Burst crashes on the corrupt file instead of treating it as a cache miss, and the poisoned target then fails every incremental build until someone runs a clean build. New PR targets can also inherit a poisoned cache from the template target via buildTargetCopyCache. Evidence it's not code: the same commit succeeded and failed 24s apart (runs 27354802918 / 27354828088), and no package/Unity/asmdef changes landed when the spike started.

This PR deletes Library/BurstCache in CloudBuild.PreExport() — which runs on the build worker after cache restore, before the Burst AOT step — so the cache always regenerates. Costs a few minutes of Burst recompile per build; a poisoned target costs a failed ~30 min build plus human retries. Non-fatal on error (logs a warning and proceeds). No Cloud Build config changes needed: PreExport is already wired in the template targets all PR targets are cloned from.

Draft for testing: verifying on this PR's own builds that [BURST]: purged restored Library/BurstCache appears in the log and the EndOfStreamException failures stop, plus measuring the build-time cost before merging.

Test Instructions

Steps (standard run): N/A — build infrastructure change only.

Expected result: N/A

Steps (fresh account): N/A

Expected result: N/A

Automation (if applicable): N/A

Prerequisites

  • None — the change takes effect on any Cloud Build of this branch

Test Steps

  1. Let this PR's Unity Cloud Build run.
  2. Check the build log for [BURST]: purged restored Library/BurstCache (or the "nothing to purge" line on a clean target).
  3. Compare Unity ran in N seconds against recent dev builds to measure the Burst recompile cost.
  4. Re-run the build a few times — no EndOfStreamException / "Failed to find entry-points" failures should occur.

Additional Testing Notes

  • If failures persist with the purge log present, the AOT compiler reads a cache outside Library/BurstCache (e.g. under Library/Bee) and the purge path needs widening.
  • Follow-up worth checking: whether a Burst patch newer than 1.8.28 handles corrupt hash caches as cache misses.

Quality Checklist

  • Changes have been tested locally
  • Documentation has been updated (if required)
  • Performance impact has been considered
  • For SDK features: Test scene is included

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@aixaCode aixaCode added the force-build Used to trigger a build on draft PR label Jun 11, 2026
@m3taphysics

Copy link
Copy Markdown
Collaborator

PR #8966, run #27372815381

Builds: Windows change, Windows baseline, macOS change, macOS baseline

How to read this table
  • Each build is measured 3 times. The values are the median, and (min–max) is the lowest and highest of those runs — a wide range means the metric is noisy and small differences are not trustworthy.
  • Δ is Change minus Baseline (a negative Δ means Change is faster).
  • 🟢 faster / 🔴 slower — a real difference: larger than both 3% and the run-to-run range.
  • ⚪ within noise — the difference is smaller than how much the build varies between its own runs, so it cannot be told apart from random variation. Treat it as no change.
  • Exceptions logged — exceptions found in the run logs; more than the baseline is flagged 🔴 even when frame times look fine. The Exception breakdown under each table groups them by the explorer's report category and exception type.
  • A run that logged unusually many exceptions (at least 10 and 5× the median of its build's runs — e.g. a service was down during it) is excluded from all numbers and called out under the table.

Framework 13 i7

Metric Baseline Change Δ Result
Samples 2701 (×3) 2701 (×3)
CPU average 33.3 ms 33.3 ms -0.0 ms ⚪ within noise
CPU 1% worst 33.8 ms (33.7–34.0) 33.6 ms (33.5–33.6) -0.2 ms ⚪ within noise
CPU 0.1% worst 37.1 ms (36.0–37.2) 35.2 ms (34.4–36.2) -1.9 ms 🟢 5% faster
GPU average 7.5 ms (7.5–7.6) 7.5 ms (7.5–7.8) 0.0 ms ⚪ within noise
GPU 1% worst 19.7 ms (19.2–20.0) 19.0 ms (18.9–20.9) -0.7 ms ⚪ within noise
GPU 0.1% worst 24.8 ms (24.1–26.8) 23.9 ms (22.9–30.9) -0.9 ms ⚪ within noise
Exceptions logged 6 6 0 ⚪ none new
Exception breakdown
Exception Baseline Change
[ENGINE] NullReferenceException 6 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

force-build Used to trigger a build on draft PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants