On Mon, Dec 18, 2017 at 03:00:15PM +0100, Christopher Faulet wrote:
> This patch should fix the following bug reported on discourse:
> https://discourse.haproxy.org/t/freeze-sockets-in-1-8-1-no-http-2/1912
>
> I reproduced the bug described on discourse and my patch fixes it. But,
> I will ask for confirmation to be sure it is the same bug.
Thanks Christopher. However, I don't like much the fact that we're starting
to have to reimplement parts of deinit() for the master process, and we'll
always miss a few parts there.
I think a better and more durable solution would look like the totally
untested code below (at least a cleaner version of it) :
diff --git a/src/log.c b/src/log.c
index 0b8467f..de775af 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1176,6 +1176,7 @@ void __send_log(struct proxy *p, int level, char
*message, size_t size, char *sd
setsockopt(*plogfd, SOL_SOCKET, SO_RCVBUF, &zero,
sizeof(zero));
/* does nothing under Linux, maybe needed for others */
shutdown(*plogfd, SHUT_RD);
+ fcntl(*plogfd, F_SETFD, fcntl(*plogfd, F_GETFD,
FD_CLOEXEC) | FD_CLOEXEC);
}
switch (logsrv->format) {
This way we're certain that the socket will alwyays be closed, regardless
of the fact that we call the deinit() code or not. Additionally, it will
take care of closing all such possible log sockets in the future if the
code is duplicated for whatever reason.
What do you think ?
Thanks,
Willy