Merge "Increase per-process file limits for multiproduct_kati"
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"android/soong/ui/build"
|
"android/soong/ui/build"
|
||||||
@@ -159,6 +160,30 @@ func (s *Status) Finished() int {
|
|||||||
return s.failed
|
return s.failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(b/70370883): This tool uses a lot of open files -- over the default
|
||||||
|
// soft limit of 1024 on some systems. So bump up to the hard limit until I fix
|
||||||
|
// the algorithm.
|
||||||
|
func setMaxFiles(log logger.Logger) {
|
||||||
|
var limits syscall.Rlimit
|
||||||
|
|
||||||
|
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limits)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Failed to get file limit:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Verbosef("Current file limits: %d soft, %d hard", limits.Cur, limits.Max)
|
||||||
|
if limits.Cur == limits.Max {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
limits.Cur = limits.Max
|
||||||
|
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limits)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Failed to increase file limit:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func inList(str string, list []string) bool {
|
func inList(str string, list []string) bool {
|
||||||
for _, other := range list {
|
for _, other := range list {
|
||||||
if str == other {
|
if str == other {
|
||||||
@@ -228,6 +253,8 @@ func main() {
|
|||||||
trace.SetOutput(filepath.Join(config.OutDir(), "build.trace"))
|
trace.SetOutput(filepath.Join(config.OutDir(), "build.trace"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setMaxFiles(log)
|
||||||
|
|
||||||
vars, err := build.DumpMakeVars(buildCtx, config, nil, []string{"all_named_products"})
|
vars, err := build.DumpMakeVars(buildCtx, config, nil, []string{"all_named_products"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
Reference in New Issue
Block a user