Fix soong_ui file rlimits for go 1.21
Go 1.21 modifies the file limit but restores the original when
execing subprocesses if it hasn't be overridden. Call Setrlimit
even if it doesn't appear to be necessary so that the syscall package
considers it set.
Bug: 309895579
Test: m nothing
Change-Id: I4d0b27bac90a2a88bfc68a8491d54dc106e1ec13
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index 18cba77..4484a48 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -680,9 +680,11 @@
}
ctx.Verbosef("Current file limits: %d soft, %d hard", limits.Cur, limits.Max)
- if limits.Cur == limits.Max {
- return
- }
+
+ // Go 1.21 modifies the file limit but restores the original when
+ // execing subprocesses if it hasn't be overridden. Call Setrlimit
+ // here even if it doesn't appear to be necessary so that the
+ // syscall package considers it set.
limits.Cur = limits.Max
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limits)