Skip to content

Experiment: Add swap before the E2E build (wp/7.0) - #855

Closed
desrosj wants to merge 2 commits into
wp/7.0from
test/e2e-build-swap-wp-7.0
Closed

desrosj wants to merge 2 commits into
wp/7.0from
test/e2e-build-swap-wp-7.0

Conversation

@desrosj

@desrosj desrosj commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Note

This is an experiment PR on a fork. It isn't meant to be merged as is.

What?

Adds a 4 GB swap file before npm run build -- --skip-types in the E2E Playwright jobs on wp/7.0. It also adds a workflow that measures how much memory, swap and how many processes that build uses under the limits of the standard runners for private repositories (2 vCPU, 8 GB RAM).

Why?

On runners with fewer resources, such as those used by private forks, an E2E shard occasionally fails in "Npm build" with [plugin sass-plugin] spawn ENOMEM. wp-build on this branch starts every package's build at once, and each one with Sass starts its own sass-embedded compiler process. When committed memory runs out, the kernel refuses to start another process.

Trunk fixed this inside wp-build (WordPress#79889). This tries a fix that doesn't change the published @wordpress/build package: more swap raises the amount of memory the kernel lets processes commit.

The hosted Ubuntu image already has 3 GB of swap (/mnt/swapfile), so this adds a second 4 GB file on the /mnt disk.

How?

  • end2end-test.yml: an "Add swap space" step (fallocate, mkswap, swapon on /mnt/swapfile-build) right before "Npm build".

  • build-memory-experiment.yml: each leg runs the same build inside a systemd scope limited to MemoryMax=7G (8 GB minus about 1 GB for the OS and runner agent), CPUQuota=200%, taskset -c 0,1 and GOMAXPROCS=2. The legs differ only in swap:

    • no swap;
    • the image's 3 GB of swap;
    • the image's swap plus the new 4 GB file.

    Each leg reports to the job summary:

    • the cgroup's peak memory and peak swap;
    • the peak process count;
    • the number of OOM kills;
    • the duration.

    The "Runner resources" step also logs vm.overcommit_*, CommitLimit and Committed_AS.

Testing

  • In the E2E runs on this PR, "Add swap space" should succeed and swapon --show should list both files.
  • The experiment's summary shows how much headroom the build has with each amount of swap.

A cgroup memory limit doesn't reproduce the kernel's system-wide commit check that produces spawn ENOMEM. The experiment shows how close the build gets to the limits, not the exact failure.

🤖 Generated with Claude Code

https://claude.ai/code/session_011Y86gzn3apHfS8kjjkmzTW

desrosj and others added 2 commits October 27, 2026 13:43
The build starts many processes at once. On runners with fewer resources,
such as those used by private forks, the kernel can refuse to start more of
them, failing the build with `spawn ENOMEM`. A 4 GB swap file raises the
amount of memory that can be committed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gzn3apHfS8kjjkmzTW
…mits.

Runs `npm run build -- --skip-types` inside a cgroup capped at the limits of
the standard runners for private repositories (2 vCPU, 8 GB RAM), with no
swap, the image's swap, and an extra 4 GB swap file, and reports the peak
memory, swap and process count of each.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gzn3apHfS8kjjkmzTW
@desrosj desrosj self-assigned this Oct 27, 2026
@github-actions

Copy link
Copy Markdown

🤖 PR meta 🤖

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

1 participant