Skip to content

Commit cc1d693

Browse files
authored
bugfix: mysql driver doesn't handle well server side query timeout (Query execution was interrupted).
in case we set in the mysql query time limit which is low than executed queries like: SET GLOBAL MAX_EXECUTION_TIME=1; the driver doesn't handle well the error: 1. doesn't parse the error well 2. doesn't report it well 3. will cause connection close due to timeout on the rows _recv_packet() - because the state doesn't enable us to setkeepalive on it. solution: in read rows loop we should handle the error, report it, and keep the connection state connected.
1 parent f0acb73 commit cc1d693

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/resty/mysql.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,12 @@ local function read_result(self, est_nrows)
13911391
break
13921392
end
13931393

1394+
if typ == RESP_ERR then
1395+
self.state = STATE_CONNECTED
1396+
local errno, msg, sqlstate = _parse_err_packet(packet)
1397+
return nil, msg, errno, sqlstate
1398+
end
1399+
13941400
local row = _parse_row_data_packet(packet, cols, compact)
13951401
i = i + 1
13961402
rows[i] = row

0 commit comments

Comments
 (0)