HAProxy community

HAProxy reloads results in fd count increase

we use haproxy in our environment and we recently upgraded to 2.1.0 from 2.0.

Now everytime we reload, the number of FD is increasing by 1. This was not the case in version 2.0.

The fd limit for root user is set to 1024, after 1024 reloads, the haproxy process starts to fail and the reload works no more.
new changes are not being applied.

This happens in haproxy 2.2 as well.

to give a background, we reload the haproxy very frequently so we hit the fd limit real soon and our services starts to fail.

This issue does not happen if we do not read the server-state during reload.

Below is the experiment, and it shows the fd count increase.

  root@haproxynode:/usr/local/src/haproxy-2.2.0# ls -l /proc/$(systemctl status haproxy |grep 'Main PID' |awk '{print $3}')/fd
total 0
lr-x------ 1 root root 64 Jul  9 09:11 0 -> /dev/null
lrwx------ 1 root root 64 Jul  9 09:11 1 -> 'socket:[254090076]'
lrwx------ 1 root root 64 Jul  9 09:11 10 -> 'socket:[254090089]'
lrwx------ 1 root root 64 Jul  9 09:11 2 -> 'socket:[254090076]'
lrwx------ 1 root root 64 Jul  9 09:11 3 -> 'socket:[254090081]'
lrwx------ 1 root root 64 Jul  9 09:11 4 -> 'anon_inode:[eventpoll]'
lr-x------ 1 root root 64 Jul  9 09:11 5 -> /path/to/haproxy/server-state
lr-x------ 1 root root 64 Jul  9 09:11 6 -> 'pipe:[254090092]'
l-wx------ 1 root root 64 Jul  9 09:11 7 -> 'pipe:[254090092]'

root@haproxynode:/usr/local/src/haproxy-2.2.0# systemctl reload haproxy

root@haproxynode:/usr/local/src/haproxy-2.2.0# ls -l /proc/$(systemctl status haproxy |grep 'Main PID' |awk '{print $3}')/fd
total 0
lr-x------ 1 root root 64 Jul  9 09:11 0 -> /dev/null
lrwx------ 1 root root 64 Jul  9 09:11 1 -> 'socket:[254090076]'
l-wx------ 1 root root 64 Jul  9 09:11 10 -> 'pipe:[254090150]'
lrwx------ 1 root root 64 Jul  9 09:11 2 -> 'socket:[254090076]'
lrwx------ 1 root root 64 Jul  9 09:11 4 -> 'socket:[254090139]'
lr-x------ 1 root root 64 Jul  9 09:11 5 -> /path/to/haproxy/server-state
lrwx------ 1 root root 64 Jul  9 09:11 6 -> 'anon_inode:[eventpoll]'
lr-x------ 1 root root 64 Jul  9 09:11 7 -> /path/to/haproxy/server-state
lr-x------ 1 root root 64 Jul  9 09:11 8 -> 'pipe:[254090150]'
lrwx------ 1 root root 64 Jul  9 09:11 9 -> 'socket:[254090148]'


root@haproxynode:/usr/local/src/haproxy-2.2.0# haproxy -v
HA-Proxy version 2.2.0 2020/07/07 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2025.
Known bugs: http://www.haproxy.org/bugs/bugs-2.2.0.html
Running on: Linux 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64
root@haproxynode:/usr/local/src/haproxy-2.2.0#

The number of fd reading the server-state increased to 2. Is this a known bug? or do we have to do something different in newer versions?

1 Like

Sounds like a bug, can you file an issue at Github?

1 Like

Sure, I will do that. Done

1 Like