5.6 with enabled HandlerSocket hangs on shutdown
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
High
|
Laurynas Biveinis | ||
5.5 |
Invalid
|
Undecided
|
Unassigned | ||
5.6 |
Fix Released
|
High
|
Laurynas Biveinis |
Bug Description
markus_albe (markus-albe) wrote on 2014-11-26: #8
Customer reproduced with 5.6.21 and I verified through code inspection:
Error log showed
2014-11-25 05:16:14 31200 [Note] /usr/sbin/mysqld: Normal shutdown
2014-11-25 05:16:14 31200 [Note] Giving 24 client threads a chance to die gracefully
2014-11-25 05:16:14 31200 [Note] Event Scheduler: Purging the queue. 0 events
2014-11-25 05:16:14 31200 [Note] Shutting down slave threads
2014-11-25 05:16:16 31200 [Note] Forcefully disconnecting 24 remaining clients
Then pmp showed:
23 __lll_lock_
1 __lll_lock_
Definition of dena::dbcontext
dbcontext:
{
DBG_THR(
unlock_tables_if();
my_pthread_
{
pthread_
#if MYSQL_VERSION_ID >= 50600
remove_
#else
--thread_count;
#endif
delete thd;
thd = 0;
pthread_
my_thread_end();
}
}
And definition of remove_
void remove_
{
DBUG_
mysql_
mysql_
DBUG_
/*
Used by binlog_
DEBUG_SYNC here, but that's not possible because the THD's debug
sync feature has been shut down at this point.
*/
DBUG_
const size_t num_erased= global_
if (num_erased == 1)
--global_
// Removing a THD that was never added is an error.
DBUG_ASSERT(1 == num_erased);
mysql_
mysql_
mysql_
}
So my understanding is that the second time this tries to acquire the mutex here (mysql_
fgrep -RnI --exclude-
./tests/
./sql/mysqld.
./mysys/
./mysys/
About MY_MUTEX_INIT_FAST:
#ifdef PTHREAD_
extern pthread_mutexattr_t my_fast_mutexattr;
#define MY_MUTEX_INIT_FAST &my_fast_mutexattr
#else
#define MY_MUTEX_INIT_FAST NULL
#endif
...
#ifdef PTHREAD_
/*
Set mutex type to "fast" a.k.a "adaptive"
In this case the thread may steal the mutex from some other thread
that is waiting for the same mutex. This will save us some
context switches but may cause a thread to 'starve forever' while
waiting for the mutex (not likely if the code within the mutex is
short).
*/
pthread_
pthread_
#endif
tags: added: i48431
Hide
Laurynas Biveinis (laurynas-biveinis) wrote on 2014-11-26: #9
Markus, can you report this upstream?
Antony Dovgal (tony2001) wrote on 2014-11-28: #14
I went ahead and made a small patch fixing this issue: https:/
Pull request for the issue: https:/
Related branches
- George Ormond Lorch III (community): Approve (g2)
-
Diff: 89 lines (+42/-0)6 files modifiedmysql-test/include/have_handler_socket.inc (+15/-0)
mysql-test/include/plugin.defs (+1/-0)
mysql-test/r/handler_socket.result (+4/-0)
mysql-test/t/handler_socket-master.opt (+1/-0)
mysql-test/t/handler_socket.test (+14/-0)
plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.cpp (+7/-0)
5.6 bits moved from bug 1319904.