ci: move Linux Go temp dir to tmpfs and stop Postgres statement logging (#28919)

Seven `test-go-pg` failures on `main` since 2026-08-31 share one
signature: unrelated tests in different packages expire their contexts
within the same few seconds while the process keeps logging normally.
Only filesystem writes and database round trips stall. This points at
the runner's EBS-backed root disk, not CPU.

- Mount an 8 GB tmpfs on GOTMPDIR for Linux jobs using the test-go-pg
action. It holds test binaries and per-test temp dirs. Windows and macOS
already use RAM-backed storage; Linux was the only platform on disk.
- Stop `log_statement=all` on the CI test Postgres container. Nothing in
the test jobs reads it, and with 64 concurrent tests it is the largest
continuous disk writer. The gen job keeps the default.
- Sample `vmstat` and `iostat` during the test step and upload on
failure, so the next occurrence can confirm or refute the disk theory.

Depot documents the 8-core Linux runner as an EBS volume at 8000 IOPS
and 250 MB/s behind an 8 GB in-memory write buffer, which fits a stall
that hits every writer at once.

Refs coder/internal#1365
This commit is contained in:
Bobby Ho authored and GitHub committed 2026-09-08 09:53:17 -07:00
1 parent 7846490770
commit d69e235edf
2 files changed
+48 -1

No files matched your search

+45
View File
@@ -50,13 +50,38 @@ inputs:
runs:
using: "composite"
steps:
- name: Mount tmpfs for Go temp dir (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
# GOTMPDIR holds test binaries and t.TempDir() output. Keep them off
# the EBS-backed root disk like the Windows and macOS RAM disks do.
if [[ -z "${GOTMPDIR:-}" ]]; then
echo "GOTMPDIR is not set, skipping"
exit 0
fi
mkdir -p "${GOTMPDIR}"
sudo mount -t tmpfs -o size=8g tmpfs "${GOTMPDIR}"
- name: Start PostgreSQL Docker container (Linux)
if: runner.os == 'Linux'
shell: bash
env:
POSTGRES_VERSION: ${{ inputs.postgres-version }}
TEST_POSTGRES_LOG_STATEMENT: none
run: make test-postgres-docker
- name: Start I/O sampler (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
nohup vmstat -t 1 > "${RUNNER_TEMP}/vmstat.log" 2>&1 &
echo $! > "${RUNNER_TEMP}/vmstat.pid"
if command -v iostat > /dev/null; then
nohup iostat -dxt 1 > "${RUNNER_TEMP}/iostat.log" 2>&1 &
echo $! > "${RUNNER_TEMP}/iostat.pid"
fi
- name: Setup Embedded Postgres (Windows/macOS)
if: runner.os != 'Linux'
shell: bash
@@ -102,3 +127,23 @@ runs:
else
make test
fi
- name: Stop I/O sampler (Linux)
if: always() && runner.os == 'Linux'
shell: bash
run: |
for name in vmstat iostat; do
pidfile="${RUNNER_TEMP}/${name}.pid"
[[ -f "${pidfile}" ]] && kill "$(cat "${pidfile}")" 2> /dev/null || true
done
- name: Upload I/O samples (Linux)
if: failure() && runner.os == 'Linux'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: io-samples-${{ github.job }}
path: |
${{ runner.temp }}/vmstat.log
${{ runner.temp }}/iostat.log
if-no-files-found: ignore
retention-days: 7
+3 -1
View File
@@ -218,6 +218,8 @@ VERSION := $(shell ./scripts/version.sh)
POSTGRES_VERSION ?= 17
POSTGRES_IMAGE ?= us-docker.pkg.dev/coder-v2-images-public/public/postgres:$(POSTGRES_VERSION)
# CI test jobs set this to "none": nothing reads the statement log there.
TEST_POSTGRES_LOG_STATEMENT ?= all
# Limit parallel Make jobs in pre-commit/pre-push. Defaults to
# nproc/4 (min 2) since test, lint, and build targets have internal
@@ -1683,7 +1685,7 @@ test-postgres-docker:
-c fsync=off \
-c synchronous_commit=off \
-c full_page_writes=off \
-c log_statement=all
-c log_statement=$(TEST_POSTGRES_LOG_STATEMENT)
while ! pg_isready -h 127.0.0.1
do
echo "$$(date) - waiting for database to start"