From 03f0b58e1e89516e0a4d72085d6f820bc4abbbd6 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Wed, 3 Jul 2024 20:23:05 +0000 Subject: [PATCH] Check POLLHUP if unable to read anything from network This solves a possible infinite loop that arises after commit e81895e . Commit e81895e prevents closing connections in case of temporary failures, but on the other side it doesn't allow to close faulty connections. --- lib/mysql_data_stream.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/mysql_data_stream.cpp b/lib/mysql_data_stream.cpp index 552ea40f7..f996cc2be 100644 --- a/lib/mysql_data_stream.cpp +++ b/lib/mysql_data_stream.cpp @@ -726,6 +726,12 @@ int MySQL_Data_Stream::read_from_net() { // it seems we end in shut_soft() anyway } } + if ( (revents & POLLHUP) ) { + // this is a final check + // Only if the amount of data read is 0 or less, then we check POLLHUP + proxy_debug(PROXY_DEBUG_NET, 5, "Session=%p, Datastream=%p -- shutdown soft. revents=%d , bytes read = %d\n", sess, this, revents, r); + shut_soft(); + } } else { queue_w(queueIN,r); bytes_info.bytes_recv+=r;