Intermittently stalled or crashing shutdown if it's issued immediately after HandlerSocket startup
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Invalid
|
Undecided
|
Unassigned | |||
5.6 |
Fix Released
|
High
|
Laurynas Biveinis | |||
5.7 |
Invalid
|
Undecided
|
Unassigned |
Bug Description
If server is shutdown immediately after HandlerSocket plugin has initialized, it may hit a race condition between worker thread initialisation, which happens asynchronously, and at some point adds threads to the server global thread list, and server shutdown, which waits for the thread count to go down to zero. This race condition may result in some worker threads not receiving kill notifications, and thus hanging the server shutdown
On 5.6 trunk:
main.handler_socket w1 [ fail ]
Test ended at 2016-08-25 08:24:42
CURRENT_TEST: main.handler_socket
--- /mnt/workspace/
+++ /mnt/workspace/
@@ -1,4 +1,5 @@
call mtr.add_
INSTALL PLUGIN handlersocket SONAME 'HANDLER_SOCKET';
Restarting mysqld for bug 1397859 test...
+shutdown_server timeout 60 exceeded, SIGKILL sent to the server
UNINSTALL PLUGIN handlersocket;
tags: | added: ci handlersocket |
summary: |
- Test main.handler_socket is unstable + Intermittently stalled shutdown if it's issued immediately after + HandlerSocket startup |
description: | updated |
description: | updated |
tags: | added: upstream |
summary: |
- Intermittently stalled shutdown if it's issued immediately after - HandlerSocket startup + Intermittently stalled or crashing shutdown if it's issued immediately + after HandlerSocket startup |
The same race condition may also result in a crash:
Core was generated by `/home/ laurynas/ obj-percona- 5.6-debug/ sql/mysqld- debug --defaults- group-suffix= .'. <optimized out>, signo=11) at ../sysdeps/ unix/sysv/ linux/pthread_ kill.c: 62 unix/sysv/ linux/pthread_ kill.c: No such file or directory. <optimized out>, signo=11) at ../sysdeps/ unix/sysv/ linux/pthread_ kill.c: 62 mysql-server/ mysys/stacktrac e.c:422 mysql-server/ sql/signal_ handler. cc:236 mysql_rwlock_ rdlock (that=0x8, src_file=0xf591c8 "/home/ laurynas/ mysql-server/ sql/rpl_ gtid.h" , src_line=347) at /home/laurynas/ mysql-server/ include/ mysql/psi/ mysql_thread. h:856 rwlock: :rdlock (this=0x0) at /home/laurynas/ mysql-server/ sql/rpl_ gtid.h: 347 bfc0) at /home/laurynas/ mysql-server/ sql/rpl_ gtid_execution. cc:454 bfc0, all=true) at /home/laurynas/ mysql-server/ sql/handler. cc:1716 bfc0) at /home/laurynas/ mysql-server/ sql/transaction .cc:334 2bfc0) at /home/laurynas/ mysql-server/ sql/sql_ class.cc: 1706 resources (this=0x7f57841 2bfc0) at /home/laurynas/ mysql-server/ sql/sql_ class.cc: 1792 ::term_ thread (this=0x7f57840 c51b0) at /home/laurynas/ mysql-server/ plugin/ HandlerSocket- Plugin- for-MySQL/ handlersocket/ database. cpp:356 ::thr_init: :~thr_init (this=0x7f577a7 f3e80, __in_chrg= <optimized out>) at /home/laurynas/ mysql-server/ plugin/ HandlerSocket- Plugin- for-MySQL/ handlersocket/ hstcpsvr_ worker. cpp:314 worker: :run (this=0x7f57840 c50f0) at /home/laurynas/ mysql-server/ plugin/ HandlerSocket- Plugin- for-MySQL/ handlersocket/ hstcpsvr_ worker. cpp:324 throbj: :operator( ) (this=0x7f57840 c50c0) at /home/laurynas/ mysql-server/ plugin/ HandlerSocket- Plugin- for-MySQL/ handlersocket/ hstcpsvr. cpp:32 dena::worker_ throbj> ::thread_ main (arg=0x7f57840c 50c0) at /home/laurynas/ mysql-server/ plugin/ HandlerSocket- Plugin- for-MySQL/ libhsclient/ thread. hpp:71 4700) at pthread_ create. c:333 unix/sysv/ linux/x86_ 64/clone. S:109
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __pthread_kill (threadid=
62 ../sysdeps/
[Current thread is 1 (Thread 0x7f577a7f4700 (LWP 14317))]
#0 __pthread_kill (threadid=
#1 0x0000000000b0ea3e in my_write_core (sig=11) at /home/laurynas/
#2 0x000000000074c599 in handle_fatal_signal (sig=11) at /home/laurynas/
#3 <signal handler called>
#4 0x000000000062da10 in inline_
#5 0x00000000006413c0 in Checkable_
#6 0x0000000000a546d9 in gtid_rollback (thd=0x7f578412
#7 0x0000000000651d91 in ha_rollback_trans (thd=0x7f578412
#8 0x00000000008e95c1 in trans_rollback (thd=0x7f578412
#9 0x00000000007babed in THD::cleanup (this=0x7f57841
#10 0x00000000007bafba in THD::release_
#11 0x00007f57a61f2e0c in dena::dbcontext
#12 0x00007f57a6200916 in dena::(anonymous namespace)
#13 0x00007f57a6200ab1 in dena::hstcpsvr_
#14 0x00007f57a620b495 in dena::worker_
#15 0x00007f57a620ccf2 in dena::thread<
#16 0x00007f57ab9b96fa in start_thread (arg=0x7f577a7f
#17 0x00007f57aae4eb5d in clone () at ../sysdeps/