From d33c5587e2dcb94c4ea4cf5e37f41cd54847f955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Tue, 24 Jan 2023 15:49:41 +0000 Subject: [PATCH] Assert on fcntl() only if not during shutdown --- lib/MySQL_Thread.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 688c91fb8..1e2ee196d 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -2850,12 +2850,14 @@ MySQL_Session * MySQL_Thread::create_new_session_and_client_data_stream(int _fd) int prevflags = fcntl(_fd, F_GETFL, 0); if (prevflags == -1) { proxy_error("For FD %d fcntl() returned -1 errno %d\n", _fd, errno); - assert (prevflags != -1); + if (shutdown == 0) + assert (prevflags != -1); } int nb = fcntl(_fd, F_SETFL, prevflags | O_NONBLOCK); if (nb == -1) { proxy_error("For FD %d fcntl() returned -1 , previous flags %d , errno %d\n", _fd, prevflags, errno); - assert (nb != -1); + if (shutdown == 0) + assert (nb != -1); } } setsockopt(sess->client_myds->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &arg_on, sizeof(arg_on));