Add gVisor keyring exhaustion regression test
gvisor-keyring-regression / keyring-regression (push) Successful in 13m2s

Run on every push. The workflow verifies that a gVisor dind has a raised keyring limit and starts 301 containers, exceeding gVisor's default 200-key limit. It passes with the dind startup workaround and fails against an unconfigured gVisor dind.
This commit is contained in:
agentbox committed 2026-11-09 14:44:56 +00:00
1 parent 6774aed8ed
commit 14106ed5e7
2 files changed
+54

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
name: gvisor-keyring-regression
on:
push:
workflow_dispatch:
jobs:
keyring-regression:
runs-on: docker
timeout-minutes: 30
steps:
- name: Check the configured gVisor keyring limit
shell: sh
run: |
set -eu
if grep -qi gvisor /proc/version; then
maxkeys=$(cat /proc/sys/kernel/keys/maxkeys)
echo "gVisor session keyring limit: ${maxkeys}"
# A default gVisor sandbox has a limit of 200, which is exhausted
# after roughly 200 container starts because runc never releases
# the session keyring it creates for each container.
if [ "${maxkeys}" -lt 1000 ]; then
echo "ERROR: gVisor keyring limit is too low for CI." >&2
echo "The dind container must use this repository's" >&2
echo "gvisor/images/basic/docker/start-dockerd.sh," >&2
echo "or GVISOR_KEY_MAXKEYS must be raised." >&2
exit 1
fi
else
echo "Not running under gVisor; skipping keyring limit check."
fi
- name: Start more containers than gVisor's default keyring limit
shell: sh
run: |
set -eu
docker pull alpine:3.20 >/dev/null
i=0
while [ "${i}" -lt 300 ]; do
i=$((i + 1))
docker run --rm --network none alpine:3.20 true >/dev/null
if [ $((i % 50)) -eq 0 ]; then
echo "started ${i} containers"
fi
done
# One more after the loop to make failures obvious at the boundary.
docker run --rm --network none alpine:3.20 true >/dev/null
echo "OK: started 301 containers without session keyring exhaustion"
+6
View File
@@ -288,6 +288,11 @@ session keyrings when their last holder exits. Upstream discussion:
- https://github.com/google/gvisor/pull/16231 - https://github.com/google/gvisor/pull/16231
- https://github.com/google/gvisor/pull/16232 - https://github.com/google/gvisor/pull/16232
The active `.gitea/workflows/gvisor-keyring.yml` workflow runs on every push.
It checks that a gVisor dind has a raised keyring limit and starts 301
containers, which exceeds the default gVisor limit of 200. It passes on a dind
built from this repository and fails against an unconfigured gVisor dind.
## Workspace bind mounts inside jobs ## Workspace bind mounts inside jobs
A workflow step such as: A workflow step such as:
@@ -365,4 +370,5 @@ gvisor/images/basic/docker/Dockerfile
gvisor/images/basic/docker/start-dockerd.sh gvisor/images/basic/docker/start-dockerd.sh
dind-runsc/resolv.conf dind-runsc/resolv.conf
scripts/workflow-*.yml scripts/workflow-*.yml
.gitea/workflows/gvisor-keyring.yml
``` ```