Fix for bug #22158: Errors in init_connect terminate connections silently

When executing the init_connect statement, thd->net.vio is set to 0, to         
forbid sending any results to the client. As a side effect we don't log         
possible errors, either.                                                        
                                                                                
Now we write warnings to the error log if an init_connect query                
fails.                                                                          
parent 8998ecbc
...@@ -1168,7 +1168,14 @@ pthread_handler_t handle_one_connection(void *arg) ...@@ -1168,7 +1168,14 @@ pthread_handler_t handle_one_connection(void *arg)
{ {
execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect); execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
if (thd->query_error) if (thd->query_error)
{
thd->killed= THD::KILL_CONNECTION; thd->killed= THD::KILL_CONNECTION;
sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
thd->thread_id,(thd->db ? thd->db : "unconnected"),
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip, "init_connect command failed");
sql_print_warning("%s", net->last_error);
}
thd->proc_info=0; thd->proc_info=0;
thd->set_time(); thd->set_time();
thd->init_for_queries(); thd->init_for_queries();
......
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