Dear haproxy:
I used haproxy as a http proxy, and make data traffic throw it . I send a
TTOU(pause) signal to the woker process of haproxy, then all of the wokers
hanging at the listen_accept (accept) function.
gaohd@nxg_88:~/haproxy$ sudo ./haproxy -f ../gaohd.cfg -W
gaohd@nxg_88:~/script$ ps -auxf |grep haproxy
root 20067 0.0 0.0 62224 4360 pts/1 S+ 18:53 0:00 |
\_ sudo ./haproxy -f ../gaohd.cfg -W
root 20068 0.0 0.0 28960 11004 pts/1 S+ 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20069 0.0 0.0 29212 1020 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20070 0.0 0.0 29212 1020 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20071 0.0 0.0 29212 1020 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20072 0.0 0.0 29212 2440 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20073 0.0 0.0 29212 2440 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20074 0.0 0.0 29212 2440 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20075 0.0 0.0 29212 2440 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20076 0.0 0.0 29212 2440 ? Ss 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
gaohd@nxg-lab-66:~$ ab -n 2000000 -c 100 http://www.axddos.com:80/index.html
gaohd@nxg_88:~/script$ sudo kill -s TTOU 20076
gaohd@nxg_88:~/script$ ps -auxf |grep haproxy
root 20067 0.0 0.0 62224 4360 pts/1 S+ 18:53 0:00 |
\_ sudo ./haproxy -f ../gaohd.cfg -W
root 20068 0.0 0.0 28960 11004 pts/1 S+ 18:53 0:00 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20069 7.7 0.0 29348 3620 ? Ds 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20070 7.7 0.0 29348 2504 ? Rs 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20071 7.6 0.0 29348 3620 ? Ds 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20072 7.7 0.0 29348 2440 ? Ds 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20073 7.7 0.0 29352 2440 ? Ds 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20074 7.7 0.0 29348 2440 ? Ds 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20075 7.7 0.0 29348 3632 ? Rs 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
root 20076 7.7 0.0 29352 2440 ? Ds 18:53 0:02 |
\_ ./haproxy -f ../gaohd.cfg -W
I download all the versions of haproxy and found that versions between 1.8.20
to 2.0.9 have this promble.
I resarch the code and found that this problem was introduced at commite
c98cdf7cc755c579a8b9cceee4809089267615ce
--- a/src/listener.c
+++ b/src/listener.c
@@ -644,7+684,14 @@ void listener_accept(int fd)
if (next_conn)
HA_ATOMIC_SUB(&l->nbconn, 1);
- if (l->nbconn < l->maxconn && l->state == LI_FULL) {
+ if (p && next_feconn)
+ HA_ATOMIC_SUB(&p->feconn, 1);
+
+ if (next_actconn)
+ HA_ATOMIC_SUB(&actconn, 1);
+
+ if ((l->state == LI_FULL && l->nbconn < l->maxconn) ||
+ (l->state == LI_LIMITED && ((!p || p->feconn < p->maxconn) &&
(actconn < global.maxconn)))) { //(The problem is case by this line)
/* at least one thread has to this when quitting */
resume_listener(l);
Is it a bug ? What is the root reason for this bug ? I didn't find out,
could you help me to answer it?