diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-12-15 20:59:21 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-12-15 20:59:21 -0200 |
commit | 4e2cf44180cac803013d086bd50fe06ab3d863a5 (patch) | |
tree | 40ac241a8b0dc4aaa69489f0e28b7b759da0511f /sql/mysqld.h | |
parent | 4ccb32c09aa0a4c9678e8cf499a552259c19d743 (diff) | |
download | mariadb-git-4e2cf44180cac803013d086bd50fe06ab3d863a5.tar.gz |
Bug#58136: Crash in vio_close at concurrent disconnect and KILL
The problem is a race between a session closing its vio
(i.e. after a COM_QUIT) at the same time it is being killed by
another thread. This could trigger a assertion in vio_close()
as the two threads could end up closing the same vio, at the
same time. This could happen due to the implementation of
SIGNAL_WITH_VIO_CLOSE, which closes the vio of the thread
being killed.
The solution is to serialize the close of the Vio under
LOCK_thd_data, which protects THD data.
No regression test is added as this is essentially a debug
issue and the test case would be quite convoluted as we would
need to synchronize a session that is being killed -- which
is a bit difficult since debug sync points code does not
synchronize killed sessions.
sql/mysqld.cc:
Drop lock parameter from close_connection, its not necessary
any more. The newly introduced THD::disconnect method will take
care of locking.
sql/mysqld.h:
Change prototype, add a default parameter for the error code.
sql/sql_class.cc:
In case SIGNAL_WITH_VIO_CLOSE is defined, the active vio is
closed and cleared. Subsequent calls will only close the vio
owned by the session.
Diffstat (limited to 'sql/mysqld.h')
-rw-r--r-- | sql/mysqld.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/mysqld.h b/sql/mysqld.h index 5d8885ac277..9218503d477 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -64,7 +64,7 @@ typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */ some places */ /* Function prototypes */ void kill_mysql(void); -void close_connection(THD *thd, uint errcode, bool lock); +void close_connection(THD *thd, uint sql_errno= 0); void handle_connection_in_main_thread(THD *thd); void create_thread_to_handle_connection(THD *thd); void unlink_thd(THD *thd); |