Browse Source
Bug#58136: Crash in vio_close at concurrent disconnect and KILL
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.pull/374/head
6 changed files with 59 additions and 33 deletions
-
45sql/mysqld.cc
-
2sql/mysqld.h
-
34sql/sql_class.cc
-
3sql/sql_class.h
-
6sql/sql_connect.cc
-
2sql/sql_parse.cc
Write
Preview
Loading…
Cancel
Save
Reference in new issue