From b6f5108d2987bcf8274c2b5adb5c75d0351a0246 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 27 Aug 2015 12:51:25 +0300 Subject: [PATCH] Fix for MXS-335 Response handling as aborted if there is not enough data. --- server/modules/protocol/mysql_backend.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/server/modules/protocol/mysql_backend.c b/server/modules/protocol/mysql_backend.c index de178fe60..661c57ca5 100644 --- a/server/modules/protocol/mysql_backend.c +++ b/server/modules/protocol/mysql_backend.c @@ -551,6 +551,18 @@ static int gw_read_backend_event(DCB *dcb) { rc = 0; goto return_rc; } + + if (!read_buffer) { + LOGIF(LM, (skygw_log_write_flush( + LOGFILE_MESSAGE, + "%lu [gw_read_backend_event] " + "Read buffer unexpectedly null, even though response " + "not marked as complete. User: %s", + pthread_self(), + current_session->user))); + rc = 0; + goto return_rc; + } } /** * Check that session is operable, and that client DCB is @@ -1562,9 +1574,10 @@ static GWBUF* process_response_data ( * enough data to read the packet length. */ init_response_status(readbuf, srvcmd, &npackets_left, &nbytes_left); - initial_packets = npackets_left; - initial_bytes = nbytes_left; } + + initial_packets = npackets_left; + initial_bytes = nbytes_left; } /** Only session commands with responses should be processed */ ss_dassert(npackets_left > 0);