Le 25/01/2018 à 11:25, Linus Thiel a écrit :
Hi,
I seem to have hit a bug running the official Docker image for HAProxy.
When specifying no-check for a server, HAProxy segfaults.
I have prepared a test case, which is attached here. To run it:
docker-compose build
docker-compose up
I get:
haproxybug_haproxy-no-check-alpine_1 exited with code 139
haproxybug_haproxy-no-check_1 exited with code 139
Tested using:
Docker version 17.12.0-ce, build c97c6d6
docker-compose version 1.17.1, build 6d101fb
Host machine is running Ubuntu 16.04, kernel 4.4.0-112-generic
Images tested are haproxy:1.8 and haproxy:1.8-alpine
If I should report this to docker-images and/or Debian instead, please
excuse me and let me know.
Hi,
This is a bug in HAProxy. I attached the patch. Willy, you can merge it.
It must be backported in 1.8.
Thanks
--
Christopher Faulet
>From ecd6e4e171c1420629e97dfe4059fbce4d85722d Mon Sep 17 00:00:00 2001
From: Christopher Faulet <[email protected]>
Date: Thu, 25 Jan 2018 11:36:35 +0100
Subject: [PATCH] BUG/MEDIUM: checks: Don't try to release undefined
conn_stream when a check is freed
When a healt-check is released, the attached conn_stream may be undefined. For
instance, this happens when 'no-check' option is used on a server line. So we
must check it is defined before trying to release it.
This patch must be backported in 1.8.
---
src/checks.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/checks.c b/src/checks.c
index 56c9d609d..0d4893e69 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -3098,10 +3098,12 @@ void free_check(struct check *check)
check->bi = NULL;
free(check->bo);
check->bo = NULL;
- free(check->cs->conn);
- check->cs->conn = NULL;
- cs_free(check->cs);
- check->cs = NULL;
+ if (check->cs) {
+ free(check->cs->conn);
+ check->cs->conn = NULL;
+ cs_free(check->cs);
+ check->cs = NULL;
+ }
}
void email_alert_free(struct email_alert *alert)
--
2.14.3