MEDIUM: backend: use a trylock to grab a connection on high FD counts as well
authorWilly Tarreau <w@1wt.eu>
Fri, 26 Mar 2021 19:52:10 +0000 (20:52 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 30 Mar 2021 16:07:49 +0000 (18:07 +0200)
commit5e22cf3a9e598f0adb9701dc1837d30d95cfaa5f
tree1102f59b09be09b971b2fffb88724788dafb4589
parentc6eedcceef97f6a5a03e2b8b35e32ec31470483c
MEDIUM: backend: use a trylock to grab a connection on high FD counts as well

Commit b1adf03df ("MEDIUM: backend: use a trylock when trying to grab an
idle connection") solved a contention issue on the backend under normal
condition, but there is another one further, which only happens when the
number of FDs in use is considered too high, and which obviously causes
random crashes with just 16 threads once the number of FDs is about to be
exhausted.

Like the aforementioned patch, this one should be backported to 2.3.

(cherry picked from commit 9b9f8477f8c751e366a526e2177a8aab34c80f6d)
[backported for the same reason as the first one above -- managed to
 crash on a 8c16t Xeon without it; minor ctx adjustments (list vs tree)
 and lock name]
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/backend.c