Skip to content

Monitor the memory of the macOS build and test jobs - #49

Open
Roberto-Gentili wants to merge 1 commit into
masterfrom
claude/macos-memory-monitor
Open

Roberto-Gentili wants to merge 1 commit into
masterfrom
claude/macos-memory-monitor

Conversation

@Roberto-Gentili

Copy link
Copy Markdown
Member

Three build and test jobs on macos-26-intel stopped responding in the Build and test step until the timeout of 30 minutes or the cancellation, and GitHub kept no log of them (BlobNotFound):

  • JDK 14, 28 November, timeout;
  • JDK 10, 28 November, timeout;
  • JDK 27, 29 November, cancelled.

Each of them was closed about 5 minutes after the timeout or the cancellation, which is how long GitHub waits for a runner that does not answer, and none of them has the warnings about the actions running on Node.js 20 that every completed job has: the runner itself stopped answering, and nothing that the job writes survives it. Since the macOS jobs moved to macos-26-intel on 27 November (e6e5299), 3 of the 179 jobs that got a runner were lost, in 3 of 8 runs; on the arm64 runners used before, which have half the memory, none of about 350 jobs was lost. This matches actions/runner-images#13882, random hangs of the macOS 26 x86_64 runners, so the platform is a more likely cause than the memory used by the tests, but there is no data on the memory of the macOS jobs to rule that out.

  • On macOS the tests run under the new .github/scripts/macos-memory-monitor.sh. Every 2 seconds it samples the memory pressure, the free, active, wired and compressed memory, the swap, the load and the free disk space of the runner, and the RSS and the threads of the test JVM and of Maven. It logs a summary every 30 seconds and whenever the memory pressure changes, the native memory of the test JVM every minute, and the highest values in the summary of the job.
  • If the memory pressure of the runner stays critical for 10 seconds, or the free disk space falls below 1 GB, the monitor logs the state of the runner and of the test JVM, saves a thread dump of the JVM and kills it, so that the job fails with its log instead of losing the runner.
  • The test JVM runs with Native Memory Tracking (-XX:NativeMemoryTracking=summary). The files of the monitor, with any hs_err_pid*.log and *.dumpstream, are uploaded as the artifact memory-monitor-jdk-<version>-attempt-<attempt> even when the job fails, and kept for 14 days.
  • The jobs on Windows and Ubuntu do not change.

How this is tested. actionlint 1.7.12 passes on both workflows, and reports the errors of a copy with a misspelled condition and input. The script was run on Windows with Git Bash and stubs of vm_stat, sysctl, sw_vers, df, ps, pgrep, top, jcmd and java that print what the macOS commands print: with critical memory pressure and with low disk space it logged the state, saved the thread dump and killed the stub of the test JVM, with normal values it let the command end, and in all cases it kept the exit status of the command and wrote the summary. It has not run on macOS yet: the jobs of this pull request are its first real run.

Limits. If the runner hangs without the memory growing first, the monitor cannot record it, because the log of the step and the artifact are lost with the runner; even then, the samples of the jobs that finish show how far the memory stays from the limits. Native Memory Tracking adds a little memory and time to the test JVM. The thresholds are a guess: if they kill a JVM that would have recovered, the job fails where it would have passed.

Next. When the jobs of this pull request have finished, a second commit will move the macOS jobs of the five build and test workflows to macos-15-intel, the workaround that CPython used for the same issue, to compare the duration and the memory of the jobs with the ones on macos-26-intel.

🤖 Generated with Claude Code

Three build and test jobs on macos-26-intel stopped responding in the
"Build and test" step until the timeout or the cancellation, and GitHub
kept no log of them: the runner itself stopped answering.

On macOS the tests now run under .github/scripts/macos-memory-monitor.sh,
which samples the memory of the runner and of the test JVM every 2
seconds, logs a summary every 30 seconds and the native memory of the
test JVM every minute, and kills the test JVM, after saving its thread
dump, if the memory pressure of the runner stays critical for 10 seconds
or the free disk space falls below 1 GB, so that the job fails with its
log instead of losing the runner. The test JVM runs with Native Memory
Tracking, and the files of the monitor are uploaded as an artifact.

This branch has not been deployed

No deployments
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