mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 00:57:02 +02:00
BUG/MINOR: listener: detect and handle shared sockets stopped in other processes
It may happen that during a temporary listener pause resulting from a SIGTTOU, one process gets one of its sockets disabled by another process and will not be able to recover from this situation by itself. For the protocols supporting this (TCPv4 and TCPv6 at the moment) this situation is detectable, so when this happens, let's put the listener into the PAUSED state so that it remains consistent with the real socket state. One nice effect is that just sending the SIGTTIN signal to the process is enough to recover the socket in this case. There is no need to backport this, this behavior has been there forever and the fix requires to reimplement the getsockopt() call there.
This commit is contained in:
parent
85d2ba6b78
commit
258b351704
@ -1157,6 +1157,14 @@ void listener_accept(int fd)
|
||||
/* pause the listener for up to 100 ms */
|
||||
expire = tick_add(now_ms, 100);
|
||||
|
||||
/* This may be a shared socket that was paused by another process.
|
||||
* Let's put it to pause in this case.
|
||||
*/
|
||||
if (l->rx.proto && l->rx.proto->rx_listening(&l->rx) == 0) {
|
||||
pause_listener(l);
|
||||
goto end;
|
||||
}
|
||||
|
||||
limit_global:
|
||||
/* (re-)queue the listener to the global queue and set it to expire no
|
||||
* later than <expire> ahead. The listener turns to LI_LIMITED.
|
||||
|
Loading…
Reference in New Issue
Block a user