From 3e0053ff7897059a20e563d15579907729399c03 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Mon, 13 Jul 2026 11:03:49 -0500 Subject: [PATCH 1/2] clean up emulator memory --- eng/templates/jobs/ci-emulator-tests.yml | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/eng/templates/jobs/ci-emulator-tests.yml b/eng/templates/jobs/ci-emulator-tests.yml index 7aeb3b24..4bf73dff 100644 --- a/eng/templates/jobs/ci-emulator-tests.yml +++ b/eng/templates/jobs/ci-emulator-tests.yml @@ -44,7 +44,30 @@ jobs: echo "Disk space after cleanup:" df -h displayName: 'Free disk space' - + + - bash: | + echo "Memory before cleanup:" + free -h + + # Stop Docker daemon to reclaim memory used by the daemon itself + # (docker system prune above removes artifacts but the daemon stays resident) + sudo systemctl stop docker || true + sudo systemctl stop docker.socket || true + sudo systemctl stop containerd || true + + # Stop background services not needed for unit tests + sudo systemctl stop snapd || true + sudo systemctl stop unattended-upgrades || true + sudo systemctl stop packagekit || true + + # Drop Linux filesystem caches (page cache, dentries, inodes) + sudo sync + sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' || true + + echo "Memory after cleanup:" + free -h + displayName: 'Free memory' + - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) From 27f1b8d484157a8444dfc1fe16a423afab2ad912 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Tue, 14 Jul 2026 14:19:55 -0500 Subject: [PATCH 2/2] fix for docker --- eng/templates/jobs/ci-emulator-tests.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/eng/templates/jobs/ci-emulator-tests.yml b/eng/templates/jobs/ci-emulator-tests.yml index 4bf73dff..c52c29bc 100644 --- a/eng/templates/jobs/ci-emulator-tests.yml +++ b/eng/templates/jobs/ci-emulator-tests.yml @@ -49,18 +49,15 @@ jobs: echo "Memory before cleanup:" free -h - # Stop Docker daemon to reclaim memory used by the daemon itself - # (docker system prune above removes artifacts but the daemon stays resident) - sudo systemctl stop docker || true - sudo systemctl stop docker.socket || true - sudo systemctl stop containerd || true - - # Stop background services not needed for unit tests + # Stop background services not needed for emulator tests. + # NOTE: Docker must remain running for CosmosDB/EventHub/ServiceBus emulators, + # so do NOT stop docker, docker.socket, or containerd here. sudo systemctl stop snapd || true sudo systemctl stop unattended-upgrades || true sudo systemctl stop packagekit || true - # Drop Linux filesystem caches (page cache, dentries, inodes) + # Drop Linux filesystem caches (page cache, dentries, inodes). + # This is safe for running processes, including Docker containers. sudo sync sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' || true