Skip to content

Commit

Permalink
crossbuild: add fix to set ulimit for debian images (elastic#856)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
  • Loading branch information
florianl authored Aug 9, 2022
1 parent 64cb5a0 commit 940a56c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,15 @@ func (b GolangCrossBuilder) Build() error {
verbose = "true"
}
var args []string
// There's a bug on certain debian versions:
// https://discuss.linuxcontainers.org/t/debian-jessie-containers-have-extremely-low-performance/1272
// basically, apt-get has a bug where will try to iterate through every possible FD as set by the NOFILE ulimit.
// On certain docker installs, docker will set the ulimit to a value > 10^9, which means apt-get will take >1 hour.
// This runs across all possible debian platforms, since there's no real harm in it.
if strings.Contains(image, "debian") {
args = append(args, "--ulimit", "nofile=262144:262144")
}

if runtime.GOOS != "windows" {
args = append(args,
"--env", "EXEC_UID="+strconv.Itoa(os.Getuid()),
Expand Down

0 comments on commit 940a56c

Please sign in to comment.