Bug #63066 Mysql Server Crashes every few hours, sometimes more often
Submitted: 1 Nov 2011 21:18 Modified: 2 Dec 2011 7:56
Reporter: Nathan Adams Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.1.41 OS:Linux (Ubuntu 10.4)
Assigned to: CPU Architecture:Any

[1 Nov 2011 21:18] Nathan Adams
Description:
MYSQL server crashes every two hours, comes straight back up but I am worried about data corruptions. I have checked and repaired all tables (some ISAM some innodb) but it continues to crash, below is the output of the error.log. as a point this server is also producing binary logs and acts as a mster with one slave, the slave reports no issues at all other than loosing connectivity briefly with the master.

I need help in finding why this is crashing. I have around 50 DB's on this system but they are all all quite small.

111101 20:52:16 - 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.

key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=3
max_threads=151
threads_connected=3
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346495 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x7fc820502ec0
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...
stack_bottom = 0x7fc81e3aae58 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x29) [0x7fc81eaa01a9]
/usr/sbin/mysqld(handle_segfault+0x404) [0x7fc81e7ad884]
/lib/libpthread.so.0(+0xf8f0) [0x7fc81e01d8f0]
/usr/sbin/mysqld(get_field(st_mem_root*, Field*, String*)+0x65) [0x7fc81e803aa5]
/usr/sbin/mysqld(store_schema_proc(THD*, st_table*, st_table*, char const*, bool, char const*)+0x707) [0x7fc81e8d0eb7]
/usr/sbin/mysqld(fill_schema_proc(THD*, TABLE_LIST*, Item*)+0x220) [0x7fc81e8d1180]
/usr/sbin/mysqld(get_schema_tables_result(JOIN*, enum_schema_table_state)+0x207) [0x7fc81e8cfa17]
/usr/sbin/mysqld(JOIN::exec()+0x4e5) [0x7fc81e82df25]
/usr/sbin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned lon
g long, select_result*, st_select_lex_unit*, st_select_lex*)+0x142) [0x7fc81e82a302]
/usr/sbin/mysqld(handle_select(THD*, st_lex*, select_result*, unsigned long)+0x174) [0x7fc81e82fc04]
/usr/sbin/mysqld(+0x36d9fa) [0x7fc81e7bb9fa]
/usr/sbin/mysqld(mysql_execute_command(THD*)+0x526) [0x7fc81e7bf806]
/usr/sbin/mysqld(mysql_parse(THD*, char const*, unsigned int, char const**)+0x35f) [0x7fc81e7c4cbf]
/usr/sbin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0xd69) [0x7fc81e7c5a39]
/usr/sbin/mysqld(do_command(THD*)+0xea) [0x7fc81e7c661a]
/usr/sbin/mysqld(handle_one_connection+0x23d) [0x7fc81e7b864d]
/lib/libpthread.so.0(+0x69ca) [0x7fc81e0149ca]
/lib/libc.so.6(clone+0x6d) [0x7fc81cb4b6cd]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x7fc82050d7b0 = SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= 'wealdosc'
thd->thread_id=16
thd->killed=NOT_KILLED
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.
111101 20:52:16 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
111101 20:52:16  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Last MySQL binlog file position 0 170407, file name /var/log/mysql/mysql-bin.000033
111101 20:52:17  InnoDB: Started; log sequence number 0 41918446
111101 20:52:17 [Note] Recovering after a crash using /var/log/mysql/mysql-bin
111101 20:52:17 [Note] Starting crash recovery...
111101 20:52:17 [Note] Crash recovery finished.
111101 20:52:17 [Note] Event Scheduler: Loaded 0 events
111101 20:52:17 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.41-3ubuntu12.10-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
111101 20:53:26 [ERROR] /usr/sbin/mysqld: Table './bookingdb29/players' is marked as crashed and should be repaired
111101 20:53:26 [Warning] Checking table:   './bookingdb29/players'
root@ebookingonline:/var/log/mysql#

How to repeat:
Looking at the binary logs the last statement recorded was an update which when repeated in phpmyadmin causes the server to crash again.

update sessions set expiry = '1320096632', value = 'sessiontoken|s:32:\"d04a5d06f081f10a2d082e40072238d1\";cart|O:12:\"shoppingCart\":4:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"GBP\";navigation|O:17:\"navigationHistory\":2:{s:4:\"path\";a:1:{i:0;a:4:{s:4:\"page\";s:9:\"index.php\";s:4:\"mode\";s:6:\"NONSSL\";s:3:\"get\";a:4:{s:4:\"page\";s:1:\"1\";s:4:\"sort\";s:2:\"2a\";s:6:\"osCsid\";s:26:\"nr4rjdq97fkkt0j7vi7fflj5g0\";s:5:\"cPath\";s:5:\"24_47\";}s:4:\"post\";a:0:{}}}s:8:\"snapshot\";a:0:{}}sess_discount_code|N;' where sesskey = 'nr4rjdq97fkkt0j7vi7fflj5g0'

Structure of table is:

--
-- Table structure for table `sessions`
--

CREATE TABLE IF NOT EXISTS `sessions` (
  `sesskey` varchar(32) NOT NULL,
  `expiry` int(11) unsigned NOT NULL,
  `value` text NOT NULL,
  PRIMARY KEY (`sesskey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
[1 Nov 2011 21:44] MySQL Verification Team
Please try latest released version 5.1.59 your server version 5.1.41 is quite older and re-open this bug report if the issue still happens. Thanks.
[1 Nov 2011 22:49] Nathan Adams
I have just realised that every crash was performing a SELECT on the information_schema.ROUTINES table. 

I googled this and found reference to bad or empty entries in the mysql.proc table. I had a custom routine written there that I have now deleted and the SELECT information_schema.ROUTINES now work without crashing mysql.

When I restore the routine it crashes......

Perhaps this is corrupt..... I will leave it out and test but I can now issue this SELECT STATEMENT on information_schema.ROUTINES when mysql.proc is empty.

The routine is:

INSERT INTO `proc` (`db`, `name`, `type`, `specific_name`, `language`, `sql_data_access`, `is_deterministic`, `security_type`, `param_list`, `returns`, `body`, `definer`, `created`, `modified`, `sql_mode`, `comment`) VALUES
('clients', 'SPLIT_STR', 'FUNCTION', 'SPLIT_STR', 'SQL', 'CONTAINS_SQL', 'NO', 'DEFINER', 0x0d0a202078205641524348415228323535292c0d0a202064656c696d2056415243484152283132292c0d0a2020706f7320494e540d0a, 'varchar(255) CHARSET latin1', 0x52455455524e205245504c41434528535542535452494e4728535542535452494e475f494e44455828782c2064656c696d2c20706f73292c0d0a202020202020204c454e47544828535542535452494e475f494e44455828782c2064656c696d2c20706f73202d312929202b2031292c0d0a2020202020202064656c696d2c20272729, 'root@localhost', '2010-08-13 19:49:34', '2010-08-13 19:49:34', '', '');
[2 Nov 2011 7:56] Valeriy Kravchuk
Direct insertion into mysql.proc table was never officially supported. So, please, check if the problem happens when you create your routine using normal CREATE FUNCTION way.
[3 Dec 2011 7:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".