Description:
The following full text search causes the thread to hang/deadlock in
__pthread_mutex_unlock_usercnt:
SELECT testpk FROM fti WHERE match(name,short_descr,keywords) against('+Today''s* +Spanish*' IN BOOLEAN MODE);
This thread will not go away until the mysqld process is restarted.
Here's the stacktrace for the thread:
Thread 3 (Thread 0x7f6b9e277910 (LWP 30620)):
#0 0x00007f6ba05ec722 in __pthread_mutex_unlock_usercnt (mutex=0x191f3d0) at pthread_mutex_unlock.c:66
#1 __pthread_mutex_unlock (mutex=0x191f3d0) at pthread_mutex_unlock.c:289
#2 0x00000000008b0490 in key_cache_read (keycache=0x191f320, file=17, filepos=71030784, level=3, buff=0x219b298 "\003\364?{.\236", length=0, block_length=1024, return_buffer=0)
at mf_keycache.c:2733
#3 0x0000000000864d88 in _mi_fetch_keypage (info=0x219af30, keyinfo=0x219a2b8, page=71030784, level=-1601684176, buff=0x0, return_buffer=<value optimized out>) at mi_page.c:31
#4 0x000000000086391e in _mi_search_first (info=0x219af30, keyinfo=0x219a2b8, pos=71030784) at mi_search.c:1337
#5 0x00000000008552b2 in _ft2_search (ftb=0x2179540, ftbw=0x2185100, init_search=<value optimized out>) at ft_boolean_search.c:463
#6 0x0000000000855dc2 in ft_boolean_read_next (ftb=0x2179540, record=0x2198fc0 "\374\232\207\065") at ft_boolean_search.c:829
#7 0x00000000008576ce in ha_myisam::ft_read (this=0x2198780, buf=0x2198fc0 "\374\232\207\065") at ha_myisam.cc:2055
#8 0x0000000000647035 in join_ft_read_next (info=0x218d2f0) at sql_select.cc:12035
#9 0x0000000000641391 in sub_select (join=0x219c770, join_tab=0x218d270, end_of_records=208) at sql_select.cc:11219
#10 0x0000000000643c85 in do_select (join=0x219c770, fields=0x216bd58, table=0x0, procedure=0x0) at sql_select.cc:10970
#11 0x000000000065a437 in JOIN::exec (this=0x219c770) at sql_select.cc:2251
#12 0x00000000006563b4 in mysql_select (thd=0x2169e20, rref_pointer_array=<value optimized out>, tables=<value optimized out>, wild_num=0, fields=<value optimized out>,
conds=<value optimized out>, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=0, result=0x218cc88, unit=0x216b828, select_lex=0x216bc50) at sql_select.cc:2440
#13 0x000000000065bdfc in handle_select (thd=0x2169e20, lex=0x216b788, result=0x218cc88, setup_tables_done_option=0) at sql_select.cc:269
#14 0x00000000005edd3a in execute_sqlcom_select (thd=0x2169e20, all_tables=0x218c338) at sql_parse.cc:5051
#15 0x00000000005f0f42 in mysql_execute_command (thd=0x2169e20) at sql_parse.cc:2246
#16 0x00000000005f647e in mysql_parse (thd=0x2169e20,
inBuf=0x218c000 "SELECT fti.app_registration_pk FROM app_registration_idx_live fti WHERE match(fti.name,fti.short_descr,fti.keywords) against('+Today''s* +Spanish*' IN BOOLEAN MODE)",
length=164, found_semicolon=0x7f6b9e277030) at sql_parse.cc:5970
#17 0x00000000005f736e in dispatch_command (command=COM_QUERY, thd=0x2169e20, packet=0x7f6b9e137011 "", packet_length=<value optimized out>) at sql_parse.cc:1231
#18 0x00000000005f7c36 in do_command (thd=0x2169e20) at sql_parse.cc:872
#19 0x00000000005ea526 in handle_one_connection (arg=<value optimized out>) at sql_connect.cc:1127
#20 0x00007f6ba05e8a04 in start_thread (arg=<value optimized out>) at pthread_create.c:300
#21 0x00007f6b9fa7780d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#22 0x0000000000000000 in ?? ()
After some time this blocking thread also prevents mysqld from being shutdown
normally so a kill -9 is required. This can then also lead to some myisam table
corruption.
How to repeat:
mysql> source ft_test.sql
mysql> SELECT testpk FROM fti WHERE match(name,short_descr,keywords) against('+Today''s* +Spanish*' IN BOOLEAN MODE);
Suggested fix:
We need to find out where this deadlock is coming from.