diff options
author | 2019-06-27 17:30:54 -0700 | |
---|---|---|
committer | 2019-06-27 17:30:54 -0700 | |
commit | c5845ac38eeedf9e6b1b5a2cc9d6d4d63f2e69bc (patch) | |
tree | 1f560539a4b601047eb6cdea70654aaa832a654c | |
parent | Fix error when setting swap limit on a system that has it disabled (diff) |
Disable swap memory
-rw-r--r-- | azure-pipelines.yml | 3 | ||||
-rw-r--r-- | snekbox/nsjail.py | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d22ba40..98d64bf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,6 +43,9 @@ jobs: testResultsFiles: '**/test-lint.xml' testRunTitle: 'Lint Results' + - script: sudo swapoff -a + displayName: 'Disable swap memory' + - script: | docker exec snekbox_test /bin/ash -c \ 'pipenv run coverage run -m xmlrunner' diff --git a/snekbox/nsjail.py b/snekbox/nsjail.py index b79ec9e..1ca3762 100644 --- a/snekbox/nsjail.py +++ b/snekbox/nsjail.py @@ -76,9 +76,10 @@ class NsJail: with (mem / "memory.memsw.limit_in_bytes").open("w", encoding="utf=8") as f: f.write(str(MEM_MAX)) except PermissionError: - log.info( - "Failed to disable memory swapping in the cgroup. " - "This is probably because CONFIG_MEMCG_SWAP_ENABLED is unset." + log.warning( + "Failed to set the memory swap limit for the cgroup. " + "This is probably because CONFIG_MEMCG_SWAP or CONFIG_MEMCG_SWAP_ENABLED is unset. " + "Please ensure swap memory is disabled on the system." ) @staticmethod |