From bf87d8d91167ae0831b7fb358b31cd16ddbca375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 26 Jul 2023 11:02:32 +0000 Subject: [PATCH] Close clickhouse client in case of an exception from clickhouse server --- lib/ClickHouse_Server.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/ClickHouse_Server.cpp b/lib/ClickHouse_Server.cpp index 09643d906..7c53e31c7 100644 --- a/lib/ClickHouse_Server.cpp +++ b/lib/ClickHouse_Server.cpp @@ -1363,7 +1363,8 @@ static void *child_mysql(void *arg) { myds->revents=fds[0].revents; int rb = 0; rb = myds->read_from_net(); - if (myds->net_failure) goto __exit_child_mysql; + if (myds->net_failure) + goto __exit_child_mysql; myds->read_pkts(); if (myds->encrypted == true) { // PMC-10004 @@ -1375,13 +1376,17 @@ static void *child_mysql(void *arg) { // We finally removed the chunk size as it seems that any size is possible. while (rb > 0) { rb = myds->read_from_net(); - if (myds->net_failure) goto __exit_child_mysql; + if (myds->net_failure) + goto __exit_child_mysql; myds->read_pkts(); } } sess->to_process=1; int rc=sess->handler(); - if (rc==-1) goto __exit_child_mysql; + if (rc==-1) + goto __exit_child_mysql; + if (sess->healthy==0) + goto __exit_child_mysql; } __exit_child_mysql: