From 4044a407942d16d0e78b4c6b20057164f30c3d38 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Wed, 10 Dec 2025 04:15:59 +0000 Subject: [PATCH] Skip bidirectional data check for permanent fast-forward sessions Allow permanent fast-forward sessions (SESSION_FORWARD_TYPE_PERMANENT) to continue processing when bidirectional data flow is detected, instead of treating it as a fatal error. This prevents unnecessary session termination in these specific cases while maintaining the original strict validation for all other session types. --- lib/mysql_data_stream.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/mysql_data_stream.cpp b/lib/mysql_data_stream.cpp index 840ca8d7b..063796f3b 100644 --- a/lib/mysql_data_stream.cpp +++ b/lib/mysql_data_stream.cpp @@ -451,10 +451,15 @@ void MySQL_Data_Stream::shut_hard() { void MySQL_Data_Stream::check_data_flow() { if ( (PSarrayIN->len || queue_data(queueIN) ) && ( PSarrayOUT->len || queue_data(queueOUT) ) ){ - // there is data at both sides of the data stream: this is considered a fatal error - proxy_error("Session=%p, DataStream=%p -- Data at both ends of a MySQL data stream: IN <%d bytes %d packets> , OUT <%d bytes %d packets>\n", sess, this, PSarrayIN->len , queue_data(queueIN) , PSarrayOUT->len , queue_data(queueOUT)); - shut_soft(); - generate_coredump(); + if (sess && sess->status == FAST_FORWARD && sess->session_fast_forward == SESSION_FORWARD_TYPE_PERMANENT) { + // Permanent fast-forward sessions: log warning but continue + proxy_warning("Session=%p, DataStream=%p -- Data at both ends of a MySQL data stream: IN <%d bytes %d packets> , OUT <%d bytes %d packets>\n", sess, this, queue_data(queueIN), PSarrayIN->len, queue_data(queueOUT), PSarrayOUT->len); + } else { + // All other sessions: treat as fatal error + proxy_error("Session=%p, DataStream=%p -- Data at both ends of a MySQL data stream: IN <%d bytes %d packets> , OUT <%d bytes %d packets>\n", sess, this, queue_data(queueIN), PSarrayIN->len, queue_data(queueOUT), PSarrayOUT->len); + shut_soft(); + generate_coredump(); + } } if ((myds_type==MYDS_BACKEND) && myconn && (myconn->fd==0) && (revents & POLLOUT)) { int rc;