Bug #45327 mysqld got signal 11 when trying to run GRANT statement
Submitted: 4 Jun 2009 10:56 Modified: 4 Jun 2009 21:33
Reporter: Richard Holloway Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.68 OS:Linux (CentOS release 4.7 (Final))
Assigned to: CPU Architecture:Any

[4 Jun 2009 10:56] Richard Holloway
Query being run that causes failure:
GRANT SELECT, UPDATE, DELETE ON fs.mail_addresses TO someuser@localhost IDENTIFIED BY 'somepass';

Returns error: ERROR 2013 (HY000): Lost connection to MySQL server during query

Error log shows:
090604 11:27:26 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 93184 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xaf092b0c, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/using-stack-trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do 
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0xa38d6c8 = grant select,update,delete on fs.mail_addresses to emailmanager@localhost identified by 'R6p7tL93'
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
090604 11:27:27  InnoDB: Started; log sequence number 0 45595
090604 11:27:27 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.68-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

Following the instructions on http://dev.mysql.com/doc/mysql/en/using-stack-trace.html provides the following output for command 

# resolve_stack_dump -s mysqld.sym mysqld.stack |c++filt 

0x81a62b5 handle_segfault + 757
0x84f15db list_walk + 82
0x84f1b18 my_hash_insert + 341
0x823fb21 mysql_table_grant(THD*, TABLE_LIST*, List<st_lex_user>&, List<LEX_COLUMN>&, unsigned long, bool) + 1429
0x81c134b mysql_execute_command(THD*) + 17833
0x81c395d mysql_parse(THD*, char const*, unsigned int, char const**) + 299
0x81c4781 dispatch_command(enum_server_command, THD*, char*, unsigned int) + 3305
0x81c5ae0 handle_one_connection + 2510
0xc5a3cc (?)
0xb7db4e (?)

Attempted repair:
I first restored data from backups. Same results.
I then removed and reinstall packages mysql and mysql-server from Centos repository "centosplus" the symptoms are exactly the same.

Running myisamchk */*.MYI from the data directory showed mysql.user table was corrupt. 
Running myisamchk -r mysql/user.MYI did repair the table correctly.
However the same symptoms persist.

All queries not relating to GRANTS appear to be working fine. SELECT, SHOW TABLES, SHOW TABLE STATUS etc all work fine.


How to repeat:
I cannot reproduce this on other servers running the same configuration.
[4 Jun 2009 16:01] MySQL Verification Team
Thank you for the bug report. Could you please try with latest release 5.0.82 and comment here the results. Thanks in advance.
[4 Jun 2009 21:33] Richard Holloway
Having spent more time on this today it is most likely that this is not a bug.

It has been caused by me creating a database by simply copying the data directory from another server running an earlier version of mysql into the data directory on this server. I am able to run queries against the database but there are inconsistencies in the mysql database tables `db` and `user` which I need to look into. I think this is causing the failures of GRANT statements.
Thanks for you quick attention Miguel.