fix(tests): attach the docker data-root loop with direct I/O

docker_dataroot.sh attached the data-root image with plain 'losetup --find --show', so the loop worker wrote through the page cache of the backing file. Those dirty pages were charged to whichever container cgroup issued the writes; the swarm registry (mem_limit 512m) was OOM-killed during pushes, which failed with 'write: connection reset by peer' (IAM fork run 44423631737, n8n#0: 24 kills via loop_workfn -> lo_rw_aio -> ovl_write_iter, anon 15 MB vs file_dirty 470 MiB). Attaching with --direct-io=on bypasses that page cache. A backing filesystem without direct I/O makes the attach fail, and decline exits 1 for a stated filesystem, so the axis fails loudly instead of vanishing.

Found and drafted by Stage 2.0; the unit test fails 3 subtests without the change and passes with it.

🎯 Fix: 85 %
💥 Break: 6 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 80
🚦 Gate: ⛔ fix 85 % < 90, break 6 % > 5

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-11-19 06:46:44 +00:00
1 parent 7d3cc60a53
commit 4a595ccac1
2 files changed
+13 -1

No files matched your search

@@ -122,5 +122,17 @@ class TestDockerDatarootLoopMount(unittest.TestCase):
self.assertIn(("-o", option), list(pairwise(mounts[0])))
class TestDockerDatarootLoopAttach(unittest.TestCase):
def test_the_loop_bypasses_the_page_cache_of_its_backing_image(self) -> None:
for fstype in (*DISCARD, "zfs"):
with self.subTest(fstype=fstype):
_, calls = apply(fstype)
attaches = [
argv for argv in calls if argv[0] == "losetup" and "--show" in argv
]
self.assertEqual(len(attaches), 1, calls)
self.assertIn("--direct-io=on", attaches[0])
if __name__ == "__main__":
unittest.main()