Bug #40754 killing mysql_refresh with REFRESH_GRANT causes debug assertion
Submitted: 14 Nov 2008 20:20 Modified: 28 Nov 2012 9:04
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S1 (Critical)
Version:5.1.29, 5.1.30-debug OS:Any
Assigned to: CPU Architecture:Any
Tags: KILL, mysql_refresh, REFRESH_GRANT

[14 Nov 2008 20:20] Shane Bester
Description:
009BC752    mysqld-debug.exe!_NMSG_WRITE()[crt0msg.c:195]
Version: '5.1.29-rc-community-debug-log'  socket: ''  port: 3306  MySQL Community Server - Debug (GPL)
Assertion failed: m_status == DA_ERROR || m_status == DA_OK, file f:\build\mysql-5.1.29-rc-winbuild\mysql-community-debug-5.1.29-rc-build\sql\sql_class.h, line 1106

009AAD8A    mysqld-debug.exe!abort()[abort.c:44]
009A8500    mysqld-debug.exe!_assert()[assert.c:306]
0055598A    mysqld-debug.exe!Diagnostics_area::message()[sql_class.h:1106]
005E608C    mysqld-debug.exe!acl_reload()[sql_acl.cc:705]
00678E66    mysqld-debug.exe!reload_acl_and_cache()[sql_parse.cc:6561]
0066C1C8    mysqld-debug.exe!dispatch_command()[sql_parse.cc:1355]
0066B2A7    mysqld-debug.exe!do_command()[sql_parse.cc:809]
0077B1C4    mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1115]
00843B46    mysqld-debug.exe!pthread_start()[my_winthread.c:85]
009B08C7    mysqld-debug.exe!_threadstart()[thread.c:196]
7D4DFFF1    kernel32.dll!FlsSetValue()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 00000000=(null)
thd->thread_id=56
thd->killed=KILL_QUERY

How to repeat:
same as bug #40750
[14 Nov 2008 22:18] MySQL Verification Team
Release binary prints this:

081115  0:14:42 [ERROR] Fatal error: Can't open and lock privilege tables:
081115  0:14:42 [ERROR] Can't open and lock privilege tables:
081115  0:15:19 [ERROR] Fatal error: Can't open and lock privilege tables:
081115  0:15:19 [ERROR] Can't open and lock privilege tables:
[14 Nov 2008 22:45] MySQL Verification Team
crashes release binary as well.  it takes longer.

0050B2D2    mysqld.exe!get_access()[sql_acl.cc:773]
0050EAA9    mysqld.exe!acl_load()[sql_acl.cc:589]
0050F19D    mysqld.exe!acl_reload()[sql_acl.cc:719]
0054C9BE    mysqld.exe!reload_acl_and_cache()[sql_parse.cc:6561]
00559962    mysqld.exe!dispatch_command()[sql_parse.cc:1355]
0055A36A    mysqld.exe!do_command()[sql_parse.cc:809]
005E020B    mysqld.exe!handle_one_connection()[sql_connect.cc:1115]
0064537B    mysqld.exe!pthread_start()[my_winthread.c:85]
00731B6A    mysqld.exe!_threadstart()[thread.c:196]
7D4DFFF1    kernel32.dll!FlsSetValue()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 00000000=(null)

Crash is in get_access() in this line:

for (pos=form->field+fieldnr, bit=1;
       *pos && (*pos)->real_type() == MYSQL_TYPE_ENUM &&
	 ((Field_enum*) (*pos))->typelib->count == 2 ;
       pos++, fieldnr++, bit<<=1)
[28 Nov 2008 17:03] MySQL Verification Team
to repeat:

thread 1: mysql_refresh(db,REFRESH_GRANT|REFRESH_LOG|REFRESH_TABLES|REFRESH_HOSTS |REFRESH_STATUS|REFRESH_THREADS|REFRESH_SLAVE|REFRESH_MASTER);

thread 2: kill <id of thread 1>

make sure both threads have auto_reconnect enabled too ..
[4 Dec 2008 16:42] MySQL Verification Team
testcase.. compile and run against local server - needs speedy connect times

Attachment: bug40754.c (text/plain), 6.75 KiB.

[5 May 2009 10:38] MySQL Verification Team
Maybe related. I got this, without running KILL... 5.1.34 release build:

mysqld.exe!mark_real_tables_as_free_for_reuse()[sql_base.cc:5061]
mysqld.exe!lock_tables()[sql_base.cc:5396]
mysqld.exe!open_and_lock_tables_derived()[sql_base.cc:4998]
mysqld.exe!acl_reload()[sql_acl.cc:702]
mysqld.exe!reload_acl_and_cache()[sql_parse.cc:6735]
mysqld.exe!dispatch_command()[sql_parse.cc:1423]
mysqld.exe!vio_timeout()[viosocket.c:416]
mysqld.exe!do_command()[sql_parse.cc:861]
mysqld.exe!handle_one_connection()[sql_connect.cc:1115]
mysqld.exe!pthread_start()[my_winthread.c:85]
mysqld.exe!_callthreadstart()[thread.c:293]

t some variables.
s may be invalid and cause the dump to abort...
t 00000000=(null)
id=5
NOT_KILLED
[28 Nov 2012 9:04] Nisha Padmini Gopalakrishnan
Fixed as part of bug #33982 in revision 5.1.44