merge #5243 into opencontainers/runc:main

Rodrigo Campos (1):
  libct/test: Disable GC on test run to catch leaking fds

LGTMs: kolyshkin cyphar
This commit is contained in:
Aleksa Sarai
2026-04-16 14:55:36 +10:00
+7 -1
View File
@@ -8,6 +8,7 @@ import (
"os/exec"
"path/filepath"
"reflect"
"runtime/debug"
"slices"
"strconv"
"strings"
@@ -1719,8 +1720,13 @@ func testFdLeaks(t *testing.T, systemd bool) {
if testing.Short() {
return
}
config := newTemplateConfig(t, &tParam{systemd: systemd})
// Disable GC to prevent finalizers from closing leaked fds
// between fdList() and the readlink check below.
oldGC := debug.SetGCPercent(-1)
defer debug.SetGCPercent(oldGC)
// Run a container once to exclude file descriptors that are only
// opened once during the process lifetime by the library and are
// never closed. Those are not considered leaks.