Commit 4151d16e authored by Sergei Golubchik's avatar Sergei Golubchik

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.
parent 9f7412e6
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;
#
# 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;
......@@ -3028,7 +3028,7 @@ class THD :public Statement,
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment