mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Each test_app created by the test deallocates 400-500 MB of memory on exit: ``` I1025 15:41:02.125936 3517 strace.go:561] [ 20: 20] test_app E exit_group(0x0) I1025 15:41:02.125967 3517 strace.go:599] [ 20: 20] test_app X exit_group(0x0) = 0 (0x0) (15.251µs) ... I1025 15:41:02.127646 3517 pgalloc.go:923] MemoryFile 0xc00040e000 has 165408768 reclaimable bytes ... I1025 15:41:02.137618 3517 pgalloc.go:923] MemoryFile 0xc00040e000 has 643493888 reclaimable bytes ``` The rate at which gVisor reclaims deallocated memory is overwhelmingly dominated by the cost of the underlying fallocate() syscall, which is system-dependent; when the sandbox (but not necessarily the containing machine) is idle, the lowest observed reclaim throughput in our testing infrastructure is ~116 MB/s: ``` I1025 15:41:02.289327 3517 pgalloc.go:1343] MemoryFile 0xc00040e000 start reclaiming [0x110000, 0x470000) (3538944 bytes; 1098084352 reclaimable bytes) I1025 15:41:02.345265 3517 pgalloc.go:1367] MemoryFile 0xc00040e000 end reclaiming [0x110000, 0x470000) I1025 15:41:02.345339 3517 pgalloc.go:1343] MemoryFile 0xc00040e000 start reclaiming [0x5f0000, 0x7a0000) (1769472 bytes; 1094545408 reclaimable bytes) I1025 15:41:02.375173 3517 pgalloc.go:1367] MemoryFile 0xc00040e000 end reclaiming [0x5f0000, 0x7a0000) ... I1025 15:41:07.249074 3517 pgalloc.go:1343] MemoryFile 0xc00040e000 start reclaiming [0x2aa65000, 0x2ae05000) (3801088 bytes; 490139648 reclaimable bytes) I1025 15:41:07.289862 3517 pgalloc.go:1367] MemoryFile 0xc00040e000 end reclaiming [0x2aa65000, 0x2ae05000) ``` Thus, 3 seconds is not consistently enough to reclaim 45 test_apps. Reduce the number of test_apps run during the stress phase to 25 (aside from this particular flake, 45 also occasionally causes test OOMs), and modify the test to allow up to 5 seconds to reclaim each test_app. PiperOrigin-RevId: 576982708