summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-04-25 18:59:41 +0200
committerSergei Golubchik <serg@mariadb.org>2016-04-25 22:46:43 +0200
commit22204807317c467b2f09dd0dcd13898a48501b10 (patch)
tree9ad61ee9838a7996a427eccfd81f27538f6954c5
parenta98ecc2aafcbc08f27a2f7faba872e7a0d25fee2 (diff)
downloadmariadb-git-22204807317c467b2f09dd0dcd13898a48501b10.tar.gz
MDEV-7775 Wrong error message (Unknown error) when idle sessions are killed after wait_timeout
restore the error message that was removed by mistake in ec38c1bbd709
-rw-r--r--mysql-test/r/wait_timeout_not_windows.result3
-rw-r--r--mysql-test/t/wait_timeout_not_windows.test15
-rw-r--r--sql/sql_connect.cc3
3 files changed, 20 insertions, 1 deletions
diff --git a/mysql-test/r/wait_timeout_not_windows.result b/mysql-test/r/wait_timeout_not_windows.result
new file mode 100644
index 00000000000..df70aa99221
--- /dev/null
+++ b/mysql-test/r/wait_timeout_not_windows.result
@@ -0,0 +1,3 @@
+set global log_warnings=2;
+set @@wait_timeout=1;
+set global log_warnings=@@log_warnings;
diff --git a/mysql-test/t/wait_timeout_not_windows.test b/mysql-test/t/wait_timeout_not_windows.test
new file mode 100644
index 00000000000..43ba48e4c43
--- /dev/null
+++ b/mysql-test/t/wait_timeout_not_windows.test
@@ -0,0 +1,15 @@
+source include/not_windows.inc;
+
+#
+# MDEV-7775 Wrong error message (Unknown error) when idle sessions are killed after wait_timeout
+#
+set global log_warnings=2;
+connect (foo,localhost,root);
+set @@wait_timeout=1;
+sleep 2;
+connection default;
+let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_RANGE= -50;
+let SEARCH_PATTERN= Aborted.*Got timeout reading communication packets;
+source include/search_pattern_in_file.inc;
+set global log_warnings=@@log_warnings;
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 16b53da1ebd..61f8b4081eb 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1092,7 +1092,8 @@ void end_connection(THD *thd)
}
if (!thd->killed && (net->error && net->vio != 0))
- thd->print_aborted_warning(1, ER(ER_UNKNOWN_ERROR));
+ thd->print_aborted_warning(1,
+ thd->stmt_da->is_error() ? thd->stmt_da->message() : ER(ER_UNKNOWN_ERROR));
}