From f7447facdc31c28068f7522bf90562155476a8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 13 Jul 2021 17:21:35 +0200 Subject: [PATCH] Fixed infinite loop when address specified by 'sqliteserver-mysql_ifaces' isn't available #3508 --- src/SQLite3_Server.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SQLite3_Server.cpp b/src/SQLite3_Server.cpp index 7723d2cac..eee8817b5 100644 --- a/src/SQLite3_Server.cpp +++ b/src/SQLite3_Server.cpp @@ -765,6 +765,14 @@ static void * sqlite3server_main_loop(void *arg) } fds[i].revents=0; } + // NOTE: In case the address imposed by 'sqliteserver-mysql_ifaces' isn't avaible, + // a infinite loop could take place if 'POLLNVAL' is not checked here. + // This means that trying to set a 'mysql_ifaces' to an address that is + // already taken will result into an 'assert' in ProxySQL side. + if (nfds == 1 && fds[0].revents == POLLNVAL) { + proxy_error("revents==POLLNVAL for FD=%d, events=%d\n", fds[i].fd, fds[i].events); + assert(fds[0].revents != POLLNVAL); + } __end_while_pool: if (S_amll.get_version()!=version) { S_amll.wrlock();