Repository navigation
ci(playwright): Add step to clear APT locks in workflow - #31737
chirag-madlani wants to merge 1 commit into
Conversation
Added a step to clear background APT locks if certain conditions are met.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedAdds a step to the Playwright CI workflow to clear background APT locks. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| sudo killall apt apt-get || true | ||
| sudo rm -f /var/lib/apt/lists/lock | ||
| sudo rm -f /var/cache/apt/archives/lock | ||
| sudo rm -f /var/lib/dpkg/lock* | ||
| sudo dpkg --configure -a |
There was a problem hiding this comment.
Live package-manager locks are deleted
If the runner has an active dpkg or unattended-upgrades process, or an apt process has not exited after SIGTERM, this step deletes its live lock files and immediately starts dpkg --configure -a, causing package-state races or a lock failure that aborts fixture preparation.
🔴 Playwright Results — workflow failedValidated commit ✅ 0 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky Pipeline and setup failures (78)
Performance⚪ Performance metrics unavailable; see the CI and reporting failures above.
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…ies survivable (#31746) * ci(playwright): break the cache-eviction death spiral + make apt retries survivable Diagnosis of runs 32223093113 and 32233411840 exposed three compounding defects that no amount of per-symptom patching was going to fix: 1. CACHE-EVICTION DEATH SPIRAL. The repo cache store measured 17.5 GB against a 10 GB LRU budget, with 49 of 50 caches on ephemeral refs (merge-queue branches, PR merge refs). The explicit yarn cache from #31730 was the biggest single source — on an ephemeral ref the exact key can never pre-exist, so every job saved a fresh ~700 MB duplicate (9 copies = 6.4 GB observed) even when restore-keys had restored content perfectly. Those saves evicted every main-scoped cache within ~30 minutes of creation (the #31718 apt cache created 06:15 was gone before 06:49), which turned downstream "cache hits" into cold fetches against apt mirrors / registry.yarnpkg.com / the Playwright CDN — and a bad day on any of those took the whole matrix down. More misses meant more ephemeral saves, feeding back into more eviction. Fix: every yarn and browser cache step in the reusable workflow is now RESTORE-ONLY (actions/cache/restore@v5) — ephemeral refs never save. The one writer is populate-playwright-apt-cache.yml, which runs on main and now warms all three caches (yarn, browser, apt), on the 6 h schedule, on dispatch, and on pushes to main touching yarn.lock / .nvmrc / the workflows. The plan job's run-scoped browser seeder is deliberately kept save-capable for lockfile-change entries; once eviction stops it no-ops on hit. Projected steady state ~6-8 GB, under budget, no evictions. 2. USELESS INSTALL RETRY. `timeout --signal=TERM ... npx playwright install-deps` only signals the direct child; the underlying apt-get survives and keeps holding /var/lib/apt/lists/lock. Run 32233411840 showed the exact sequence: apt had failed over from the dead Azure mirror to archive.ubuntu.com and was slowly succeeding, the 8-minute ceiling killed the wrapper mid-download, and the retry then died instantly on "Could not get lock ... held by process 15226". The same stale lock can be left by a timed-out cache-apt-pkgs action earlier in the job. Fix: a reap_apt() helper (killall -9 apt/apt-get/dpkg, remove stale lock files, dpkg --configure -a) runs BEFORE the first attempt and between attempts at both install-deps call sites. The shard job's single-attempt install gains the same one-retry loop the fixture builder already had. This adopts the diagnosis from PR #31737 at the location where it can actually work — the stale lock is created by our own timed-out first attempt, so clearing locks before the cache action (as #31737 does) runs too early to help. 3. POPULATE WORKFLOW TOO NARROW. It only warmed the apt cache; the yarn and browser caches had no main-scoped writer at all, so their first miss on any ephemeral ref started the duplicate-save churn. Verified: YAML valid on both files; all 6 yarn/browser cache steps in the reusable workflow audited restore-only; the reap+retry idiom tested under bash -e; the plan-job seeder confirmed retained. Co-Authored-By: Claude Fable 5 <[email protected]> * address greptile P1 — make the cache warmers independent The populate job ran its warmers sequentially with fail-fast semantics: a yarn-registry outage surviving all three retries (or a Chromium CDN failure) killed the job BEFORE the apt writer ran — blocking the refresh of the one cache whose absence takes down whole matrices, which is exactly the failure this workflow exists to prevent. Restructured: * apt populate runs FIRST (no node/yarn dependency) and continue-on-error, so nothing can starve it and its own failure cannot starve the others. * yarn and browser warmers are continue-on-error with explicit restore/save pairs; each save is gated on its warmer SUCCEEDING. The gating also fixes a latent bug a bare continue-on-error would have introduced: actions/cache's post-job save runs when the job succeeds, so a failed yarn install would have permanently baked a partial ~/.cache/yarn under the exact lockfile key (actions/cache never overwrites an existing key). * the browser warmer is additionally gated on the yarn warmer succeeding — npx resolves the pinned @playwright/test from the local install. * a final "Report warm failures" step fails the job if ANY warmer failed — full signal on schedule/dispatch, but only after every cache had its chance to refresh. Verified: YAML valid; apt package list + version still byte-identical to both reusable-workflow call sites; yarn/browser keys match the restore-only steps. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
Added a step to clear background APT locks if certain conditions are met.
Describe your changes:
Fixes #
I worked on ... because ...
Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
Unit tests
Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Greptile Summary
Adds a fixture-preparation step intended to recover from background APT lock contention before restoring or installing Playwright system dependencies.
aptandapt-get.dpkg --configure -abefore the cached dependency installation.Confidence Score: 4/5
The PR should not merge until the cleanup waits for package-manager owners to exit instead of deleting potentially live lock files.
The new step can leave dpkg or unattended-upgrades running while removing its locks and immediately invoking another dpkg operation, causing deterministic job failure when background package activity overlaps fixture preparation.
Files Needing Attention: .github/workflows/playwright-e2e-reusable.yml
Important Files Changed
Reviews (1): Last reviewed commit: "ci(playwright): Add step to clear APT lo..." | Re-trigger Greptile