-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory exhaustion using haproxy image #194
Comments
This sounds identical to docker-library/rabbitmq#545. The cause is that fedora and other rpm-based distros set an astronomically large value for open files ( |
I think the root cause is HAProxy allocating resources for each connection, up to the maximum, and deriving that maximum (
|
Making a note for folks who end up here via kubernetes: Looks like kubernetes relies on this to be fixed at the container service level, in my case this is containerd fixed like this:
|
When starting the haproxy image it gets OOM-killed after using up all the memory on my system (32GB + 8GB Swap) almost immediately.
I'm running using the below command - where the config file is this one
docker run -v $(pwd)/images/haproxy:/usr/local/etc/conf:ro -m 1000000000 haproxy:2.6 -f /usr/local/etc/conf/haproxy.cfg
(Note I've set a 1GB memory limit on the above to demonstrate the problem so anyone trying to replicate doesn't get exhausted completely)
I've tested this behaviour on all versions back to the haproxy 2.2 image.
This issue can be resolved by setting ulimits as below:
docker run --ulimit nofile=8053:8053 -v $(pwd)/images/haproxy:/usr/local/etc/conf:ro -m 1000000000 haproxy:2.6 -f /usr/local/etc/conf/haproxy.cfg
Or by setting the connection limit e.g.
The issue looks similar to the one investigated and closed in haproxy/haproxy#1751
I'm wondering why the haproxy docker image might use up so much memory on startup if those limits aren't set and if this is just a docker issue, or related to the binary itself. I wasn't able to replicate this using the 2.4 version of haproxy on the same system.
SYSTEM INFORMATION
Docker version
Fedora version
Kernel version
The text was updated successfully, but these errors were encountered: