From dd9a80c20d87a376ccf9363ad89ae9de6d77f825 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Thu, 10 Jun 2021 19:54:15 -0400 Subject: [PATCH] accept 4031 as a valid return code when connection closed As of 8.0.24 MySQL writes the reason the connection was closed before closing it, so 4031 (ER_CLIENT_INTERACTION_TIMEOUT) is now an valid return code. See https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html#mysqld-8-0-24-connection-management for more information. --- t/rt85919-fetch-lost-connection.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/rt85919-fetch-lost-connection.t b/t/rt85919-fetch-lost-connection.t index 72154e1c..f418a7c5 100644 --- a/t/rt85919-fetch-lost-connection.t +++ b/t/rt85919-fetch-lost-connection.t @@ -34,12 +34,18 @@ if (not $ok) { # if we're connected via a local socket we receive error 2006 # (CR_SERVER_GONE_ERROR) but if we're connected using TCP/IP we get # 2013 (CR_SERVER_LOST) + # + # as of 8.0.24 MySQL writes the reason the connection was closed + # before closing it, so 4031 (ER_CLIENT_INTERACTION_TIMEOUT) is + # now an valid return code if ($DBI::err == 2006) { pass("received error 2006 (CR_SERVER_GONE_ERROR)"); } elsif ($DBI::err == 2013) { pass("received error 2013 (CR_SERVER_LOST)"); + } elsif ($DBI::err == 4031) { + pass("received error 4031 (ER_CLIENT_INTERACTION_TIMEOUT)"); } else { - fail('Should return error 2006 or 2013'); + fail("Should return error 2006 or 2013 or 4031 but returned $DBI::err"); } eval { $sth->finish(); } if defined $sth; eval { $dbh->disconnect(); } if defined $dbh;