scripts: set nofile for fail2ban process#2792
scripts: set nofile for fail2ban process#2792yogo1212 wants to merge 1 commit intodocker-mailserver:masterfrom yogo1212:fail2ban_nofile
Conversation
|
btw:
|
|
@polarathene knows more about this and should decide whether this should be merged. |
|
I don't know what's causing it but CI seems to be failing a lot recently, I think after @polarathene merged a PR that refactors tests (showing us that there are race conditions in tests?). Can we do something about that? |
|
I've some questions regarding the problem and your provided workaround.
Just for my understanding, why is fail2ban trying to close all(?) files. What files? Why so many? I think I miss something here 😉 Can your workaround (hard-coding 1024) introduce issues for existing setups? |
|
We resolved this for our tests in #2730 we do not need to merge this. It's been a while, but I think you are setting
What Docker uses can be much larger though, and varies by linux host, often by a systemd service config (more info here). In ulimits:
nofile:
soft: $(ulimit -Sn)
hard: $(ulimit -Hn)The value probably won't work in compose like that, but if you run both A hard limit of a million appears to be minimal delay AFAIK, whereas 1 billion or more like I had caused a 10 minute start-up delay. |
You'll find that Docker is probably configured by systemd by your distro here. It varies what value is set, and it's presumably because the Docker daemon needs to support a large amount across containers? I had the same amount on my systems. Thankfully old me documented this issue heavily, plenty of details can be found on the related f2b issue I originally raised. Closing reasonRemember this does not only affect f2b, but also I'm not aware of any other software we presently ship that creates a daemon with the same issue, but it could happen with future updates. The correct approach is to set |
|
cu around :-) p.s.
i don't agree but future versions of fail2ban close only the fds that are actually open, so i'm happy anyway. |
Description
Fail2ban closes all fds on startup using
OPEN_MAX(nofile) to determine the range.In some Docker environments, nofile is set ridiculously high.
Then, fail2ban-server is busy closing files on startup and effectively hangs.
The problem is addressed upstream. Introduce a workaround until the fix trickles down.
Fixes #2781
Type of change
Checklist: