From dc41aa1bbb321e86c3a98aef2eabc1723e4ddbfd Mon Sep 17 00:00:00 2001 From: Huy Do Date: Mon, 16 Dec 2024 13:30:06 -0800 Subject: [PATCH] Clean up existing swapfile before trying to allocate a new one (#6066) Fix a potential bug from https://github.com/pytorch/test-infra/pull/6058, here is what I see in the CI when it happens https://github.com/pytorch/pytorch/actions/runs/12360769784/job/34497379880?pr=143316#step:5:165 --- .../modules/runners-instances/templates/user-data.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terraform-aws-github-runner/modules/runners-instances/templates/user-data.sh b/terraform-aws-github-runner/modules/runners-instances/templates/user-data.sh index 0f03ca6902..0716f89ac9 100644 --- a/terraform-aws-github-runner/modules/runners-instances/templates/user-data.sh +++ b/terraform-aws-github-runner/modules/runners-instances/templates/user-data.sh @@ -138,6 +138,10 @@ fi ${post_install} +# Cleanup any existing swapfile just to be sure +sudo swapoff /swapfile +sudo rm /swapfile +# before allocating a new one sudo fallocate -l 3G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile