Commit 2f01aa97 authored by Konstantin Osipov's avatar Konstantin Osipov

----------------------------------------------------------

revno: 2630.2.16
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-runtime
timestamp: Fri 2008-06-27 13:26:03 +0400
message:
  Fix max_user_connections_func failure on Solaris.
  A connection that failed to log in due to a resource limit could
  be returned to the thread pool with a dangling link to user_connect
  structure of an old user. Later on it could be authenticated
  to a user that doesn't have a resource limit, so this dangling
  link won't be reset. --pool-of-threads mode made the situation
  easy to reproduce, and thus highlighted a bug that has been
  around forever.
  Make sure there are no dangling links.
parent fd6a1a07
......@@ -151,7 +151,15 @@ int check_for_max_user_connections(THD *thd, USER_CONN *uc)
end:
if (error)
{
uc->connections--; // no need for decrease_user_connections() here
/*
The thread may returned back to the pool and assigned to a user
that doesn't have a limit. Ensure the user is not using resources
of someone else.
*/
thd->user_connect= NULL;
}
(void) pthread_mutex_unlock(&LOCK_user_conn);
DBUG_RETURN(error);
}
......@@ -462,7 +470,10 @@ check_user(THD *thd, enum enum_server_command command,
{
/* mysql_change_db() has pushed the error message. */
if (thd->user_connect)
{
decrease_user_connections(thd->user_connect);
thd->user_connect= 0;
}
DBUG_RETURN(1);
}
}
......@@ -975,7 +986,15 @@ static void end_connection(THD *thd)
NET *net= &thd->net;
plugin_thdvar_cleanup(thd);
if (thd->user_connect)
{
decrease_user_connections(thd->user_connect);
/*
The thread may returned back to the pool and assigned to a user
that doesn't have a limit. Ensure the user is not using resources
of someone else.
*/
thd->user_connect= NULL;
}
if (thd->killed || net->error && net->vio != 0)
{
......
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