diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-07-31 18:32:46 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-07-31 18:32:46 +0200 |
commit | 42ea25d4c51b5466b4b03a29abe480e763732cf2 (patch) | |
tree | 80642573c4320e628ce495d166a551aa5048d51d | |
parent | 9705ad5e339723382f914c48184441906359283b (diff) | |
download | mariadb-git-42ea25d4c51b5466b4b03a29abe480e763732cf2.tar.gz |
MDEV-375 Server crashes in THD::print_aborted_warning with log_warnings > 3
Don't use ER(xxx) in THD::close_connection(), when current_thd is already reset to NULL.
Prefer ER_THD() or ER_DEFAULT() instead.
-rw-r--r-- | mysql-test/r/mdev375.result | 14 | ||||
-rw-r--r-- | mysql-test/t/mdev375.test | 20 | ||||
-rw-r--r-- | sql/sql_class.h | 2 |
3 files changed, 35 insertions, 1 deletions
diff --git a/mysql-test/r/mdev375.result b/mysql-test/r/mdev375.result new file mode 100644 index 00000000000..32580804686 --- /dev/null +++ b/mysql-test/r/mdev375.result @@ -0,0 +1,14 @@ +SET GLOBAL log_warnings=4; +SET GLOBAL max_connections=2; +SELECT 1; +1 +1 +SELECT 2; +2 +2 +ERROR HY000: Too many connections +SELECT 0; +0 +0 +SET GLOBAL log_warnings=default; +SET GLOBAL max_connections=default; diff --git a/mysql-test/t/mdev375.test b/mysql-test/t/mdev375.test new file mode 100644 index 00000000000..547d57aa587 --- /dev/null +++ b/mysql-test/t/mdev375.test @@ -0,0 +1,20 @@ +# +# MDEV-375 Server crashes in THD::print_aborted_warning with log_warnings > 3 +# +SET GLOBAL log_warnings=4; +SET GLOBAL max_connections=2; + +--connect (con1,localhost,root,,) +SELECT 1; +--connect (con2,localhost,root,,) +SELECT 2; +--disable_query_log +--error ER_CON_COUNT_ERROR +--connect (con3,localhost,root,,) +--enable_query_log + +--connection default +SELECT 0; + +SET GLOBAL log_warnings=default; +SET GLOBAL max_connections=default; diff --git a/sql/sql_class.h b/sql/sql_class.h index 5b53f806ddb..fa75e8a2048 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3028,7 +3028,7 @@ public: if (global_system_variables.log_warnings > threshold) { Security_context *sctx= &main_security_ctx; - sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION), + sql_print_warning(ER_THD(this, ER_NEW_ABORTING_CONNECTION), thread_id, (db ? db : "unconnected"), sctx->user ? sctx->user : "unauthenticated", sctx->host_or_ip, reason); |