BUG/MEDIUM: tcp-check: don't call tcpcheck_main() from the I/O handlers!
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Oct 2017 09:58:22 +0000 (11:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Oct 2017 11:41:20 +0000 (13:41 +0200)
commitc09572fd8be6e7d7a1207bca31e14856ee7ac9d2
tree55d201b438924e91c5d01705ecb2d14e16256770
parent82feaaf0423919c5af61b59f6f3234bc0423a791
BUG/MEDIUM: tcp-check: don't call tcpcheck_main() from the I/O handlers!

This function can destroy a socket and create a new one, resulting in a
change of FD on the connection between recv() and send() for example,
which is absolutely not permitted, and can result in various funny games
like polling not being properly updated (or with the flags from a previous
fd) etc.

Let's only call this from the wake() callback which is more tolerant.
Ideally the operations should be made even more reliable by returning
a specific value to indicate that the connection was released and that
another one was created. But this is hasardous for stable releases as
it may reveal other issues.

This fix should be backported to 1.7 and 1.6.
src/checks.c