Merge pull request #8361 from jandelgado/add_udptunnel_package
[feed/packages.git] / net / haproxy / patches / 006-BUG-MEDIUM-threads-fd-do-not-forget-to-take-into-account-epoll_fd-pipes.patch
1 commit 1dfa4fd4be313a87f2a4861e81d0ad8ea8214223
2 Author: Willy Tarreau <w@1wt.eu>
3 Date: Thu Mar 14 19:10:55 2019 +0100
4
5 BUG/MEDIUM: threads/fd: do not forget to take into account epoll_fd/pipes
6
7 Each thread uses one epoll_fd or kqueue_fd, and a pipe (thus two FDs).
8 These ones have to be accounted for in the maxsock calculation, otherwise
9 we can reach maxsock before maxconn. This is difficult to observe but it
10 in fact happens when a server connects back to the frontend and has checks
11 enabled : the check uses its FD and serves to fill the loop. In this case
12 all FDs planed for the datapath are used for this.
13
14 This needs to be backported to 1.9 and 1.8.
15
16 (cherry picked from commit 2c58b41c96e70f567d0f9ae876a80770630c06ee)
17 Signed-off-by: Willy Tarreau <w@1wt.eu>
18 (cherry picked from commit 26d110ba04cba02b337beff53a83847320e4fcdb)
19 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
20
21 diff --git a/src/haproxy.c b/src/haproxy.c
22 index 68367627..5c3febdd 100644
23 --- a/src/haproxy.c
24 +++ b/src/haproxy.c
25 @@ -1828,6 +1828,9 @@ static void init(int argc, char **argv)
26 global.hardmaxconn = global.maxconn; /* keep this max value */
27 global.maxsock += global.maxconn * 2; /* each connection needs two sockets */
28 global.maxsock += global.maxpipes * 2; /* each pipe needs two FDs */
29 + global.maxsock += global.nbthread; /* one epoll_fd/kqueue_fd per thread */
30 + global.maxsock += 2 * global.nbthread; /* one wake-up pipe (2 fd) per thread */
31 +
32 /* compute fd used by async engines */
33 if (global.ssl_used_async_engines) {
34 int sides = !!global.ssl_used_frontend + !!global.ssl_used_backend;