Commit 62e6336
authored
feat(docker,podman): bump RLIMIT_NOFILE to kernel max for every container (#225)
## Summary
EL clients keep many file descriptors open while indexing chain DBs, and
typical container defaults (1024 soft / 4096 hard) trip `too many open
files` errors on long benchmark runs. Lift `RLIMIT_NOFILE` to the
highest value the host kernel allows, applied uniformly to every
container the runner creates — both Docker and Podman runtimes.
### Files
**New**
- `pkg/docker/ulimit.go` — `HostMaxNofile()` reads
`/proc/sys/fs/nr_open` (the kernel-wide ceiling above which
`RLIMIT_NOFILE` cannot be raised). Falls back to `DefaultMaxNofile =
1048576` when the file is missing/empty/unparseable (non-Linux hosts,
restricted procfs, etc.).
- `pkg/docker/ulimit_test.go` — non-zero check + Linux
`/proc/sys/fs/nr_open` sanity check.
**Updated**
- `pkg/docker/docker.go` — `hostCfg.Ulimits = []*container.Ulimit{{Name:
"nofile", Hard: nofile, Soft: nofile}}` with `nofile =
int64(HostMaxNofile())`. Set after the literal because `Ulimits` lives
on the embedded `Resources` struct.
- `pkg/podman/podman.go` — `s.Rlimits = append(s.Rlimits,
specs.POSIXRlimit{Type: "RLIMIT_NOFILE", Hard: nofile, Soft: nofile})`
with `nofile = docker.HostMaxNofile()`. Podman's specgen takes `uint64`
directly.
No config knob — always-on by design. Both `CreateContainer` paths
(regular run + init container) get the bump.
### Tests
- [x] `go build ./...` clean
- [x] `go test ./pkg/docker/...` passes
- [x] `golangci-lint run --new-from-rev=origin/master` clean
## Test plan
- [x] `docker inspect <bench-container>` should show `HostConfig.Ulimits
= [{"Name":"nofile","Soft":1048576,"Hard":1048576}]` (or whatever your
host's `cat /proc/sys/fs/nr_open` is).
- [x] Same for `podman inspect <bench-container>` under
`.HostConfig.Ulimits`.
- [x] Run a long benchmark (e.g. EEST stateful suite) on a client
previously hitting EMFILE; confirm the failure no longer reproduces.1 parent 04b0a36 commit 62e6336
4 files changed
Lines changed: 91 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
| |||
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
256 | 265 | | |
257 | 266 | | |
258 | 267 | | |
259 | 268 | | |
260 | 269 | | |
261 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| |||
248 | 252 | | |
249 | 253 | | |
250 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
251 | 265 | | |
252 | 266 | | |
253 | 267 | | |
| |||
0 commit comments