Skip to content

ci(playwright): Add step to clear APT locks in workflow - #31737

Closed
chirag-madlani wants to merge 1 commit into
mainfrom
chore/playwright-ci
Closed

chirag-madlani wants to merge 1 commit into
mainfrom
chore/playwright-ci

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Added a step to clear background APT locks if certain conditions are met.

Describe your changes:

Fixes #

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

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:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Greptile Summary

Adds a fixture-preparation step intended to recover from background APT lock contention before restoring or installing Playwright system dependencies.

  • Terminates processes named apt and apt-get.
  • Removes APT and dpkg lock files.
  • Runs dpkg --configure -a before 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

Filename Overview
.github/workflows/playwright-e2e-reusable.yml Adds forceful package-manager cleanup, but deleting locks without waiting for all possible owners introduces a package-management race that can fail fixture preparation.

Reviews (1): Last reviewed commit: "ci(playwright): Add step to clear APT lo..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Added a step to clear background APT locks if certain conditions are met.
Copilot AI lite review requested due to automatic review settings August 19, 2026 08:35

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 19, 2026
@gitar-bot

gitar-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds a step to the Playwright CI workflow to clear background APT locks. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Comment on lines +937 to +941
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

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.

P1 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.

@github-actions

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — workflow failed

Validated commit ba8ec764c905d624ace514b1a54af707f4fd437d in Playwright run 32233411840, attempt 1.

✅ 0 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Pipeline and setup failures (78)

  • Seeded fixture preparation finished with status failure.
  • The Playwright shard matrix was unexpectedly skipped.
  • Shard chromium-01 did not upload a usable Playwright results artifact.
  • Shard chromium-02 did not upload a usable Playwright results artifact.
  • Shard chromium-03 did not upload a usable Playwright results artifact.
  • Shard chromium-04 did not upload a usable Playwright results artifact.
  • Shard chromium-05 did not upload a usable Playwright results artifact.
  • Shard chromium-06 did not upload a usable Playwright results artifact.
  • Shard chromium-07 did not upload a usable Playwright results artifact.
  • Shard chromium-08 did not upload a usable Playwright results artifact.
  • Shard chromium-09 did not upload a usable Playwright results artifact.
  • Shard chromium-10 did not upload a usable Playwright results artifact.
  • Shard chromium-11 did not upload a usable Playwright results artifact.
  • Shard chromium-12 did not upload a usable Playwright results artifact.
  • Shard chromium-13 did not upload a usable Playwright results artifact.
  • Shard chromium-14 did not upload a usable Playwright results artifact.
  • Shard chromium-15 did not upload a usable Playwright results artifact.
  • Shard chromium-16 did not upload a usable Playwright results artifact.
  • Shard chromium-17 did not upload a usable Playwright results artifact.
  • Shard chromium-18 did not upload a usable Playwright results artifact.
  • Shard chromium-19 did not upload a usable Playwright results artifact.
  • Shard chromium-20 did not upload a usable Playwright results artifact.
  • Shard chromium-21 did not upload a usable Playwright results artifact.
  • Shard chromium-22 did not upload a usable Playwright results artifact.
  • Shard chromium-23 did not upload a usable Playwright results artifact.
  • Shard chromium-24 did not upload a usable Playwright results artifact.
  • Shard chromium-25 did not upload a usable Playwright results artifact.
  • Shard chromium-26 did not upload a usable Playwright results artifact.
  • Shard data-asset-rules-01 did not upload a usable Playwright results artifact.
  • Shard domain-isolation-01 did not upload a usable Playwright results artifact.
  • Shard global-state-01 did not upload a usable Playwright results artifact.
  • Shard import-export-01 did not upload a usable Playwright results artifact.
  • Shard import-export-02 did not upload a usable Playwright results artifact.
  • Shard import-export-03 did not upload a usable Playwright results artifact.
  • Shard ingestion-01 did not upload a usable Playwright results artifact.
  • Shard ingestion-02 did not upload a usable Playwright results artifact.
  • Shard reindex-01 did not upload a usable Playwright results artifact.
  • Shard reindex-02 did not upload a usable Playwright results artifact.
  • Shard search-01 did not upload a usable Playwright results artifact.
  • Shard search-rbac-01 did not upload a usable Playwright results artifact.
  • Shard chromium-01 did not upload its execution status.
  • Shard chromium-02 did not upload its execution status.
  • Shard chromium-03 did not upload its execution status.
  • Shard chromium-04 did not upload its execution status.
  • Shard chromium-05 did not upload its execution status.
  • Shard chromium-06 did not upload its execution status.
  • Shard chromium-07 did not upload its execution status.
  • Shard chromium-08 did not upload its execution status.
  • Shard chromium-09 did not upload its execution status.
  • Shard chromium-10 did not upload its execution status.
  • Shard chromium-11 did not upload its execution status.
  • Shard chromium-12 did not upload its execution status.
  • Shard chromium-13 did not upload its execution status.
  • Shard chromium-14 did not upload its execution status.
  • Shard chromium-15 did not upload its execution status.
  • Shard chromium-16 did not upload its execution status.
  • Shard chromium-17 did not upload its execution status.
  • Shard chromium-18 did not upload its execution status.
  • Shard chromium-19 did not upload its execution status.
  • Shard chromium-20 did not upload its execution status.
  • Shard chromium-21 did not upload its execution status.
  • Shard chromium-22 did not upload its execution status.
  • Shard chromium-23 did not upload its execution status.
  • Shard chromium-24 did not upload its execution status.
  • Shard chromium-25 did not upload its execution status.
  • Shard chromium-26 did not upload its execution status.
  • Shard data-asset-rules-01 did not upload its execution status.
  • Shard domain-isolation-01 did not upload its execution status.
  • Shard global-state-01 did not upload its execution status.
  • Shard import-export-01 did not upload its execution status.
  • Shard import-export-02 did not upload its execution status.
  • Shard import-export-03 did not upload its execution status.
  • Shard ingestion-01 did not upload its execution status.
  • Shard ingestion-02 did not upload its execution status.
  • Shard reindex-01 did not upload its execution status.
  • Shard reindex-02 did not upload its execution status.
  • Shard search-01 did not upload its execution status.
  • Shard search-rbac-01 did not upload its execution status.

Performance

⚪ Performance metrics unavailable; see the CI and reporting failures above.

Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
⛔ Shard chromium-01 — — — — — —
⛔ Shard chromium-02 — — — — — —
⛔ Shard chromium-03 — — — — — —
⛔ Shard chromium-04 — — — — — —
⛔ Shard chromium-05 — — — — — —
⛔ Shard chromium-06 — — — — — —
⛔ Shard chromium-07 — — — — — —
⛔ Shard chromium-08 — — — — — —
⛔ Shard chromium-09 — — — — — —
⛔ Shard chromium-10 — — — — — —
⛔ Shard chromium-11 — — — — — —
⛔ Shard chromium-12 — — — — — —
⛔ Shard chromium-13 — — — — — —
⛔ Shard chromium-14 — — — — — —
⛔ Shard chromium-15 — — — — — —
⛔ Shard chromium-16 — — — — — —
⛔ Shard chromium-17 — — — — — —
⛔ Shard chromium-18 — — — — — —
⛔ Shard chromium-19 — — — — — —
⛔ Shard chromium-20 — — — — — —
⛔ Shard chromium-21 — — — — — —
⛔ Shard chromium-22 — — — — — —
⛔ Shard chromium-23 — — — — — —
⛔ Shard chromium-24 — — — — — —
⛔ Shard chromium-25 — — — — — —
⛔ Shard chromium-26 — — — — — —
⛔ Shard data-asset-rules-01 — — — — — —
⛔ Shard domain-isolation-01 — — — — — —
⛔ Shard global-state-01 — — — — — —
⛔ Shard import-export-01 — — — — — —
⛔ Shard import-export-02 — — — — — —
⛔ Shard import-export-03 — — — — — —
⛔ Shard ingestion-01 — — — — — —
⛔ Shard ingestion-02 — — — — — —
⛔ Shard reindex-01 — — — — — —
⛔ Shard reindex-02 — — — — — —
⛔ Shard search-01 — — — — — —
⛔ Shard search-rbac-01 — — — — — —

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

chirag-madlani added a commit that referenced this pull request Aug 19, 2026
…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]>

This branch was previously deployed

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

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants