MySql Crash - Won't Restart

dstana

Well-Known Member
Jul 6, 2016
108
19
68
Phoenix, AZ
cPanel Access Level
Root Administrator
Had mysql crash this morning and couldn't get it to restart. From the error log:

Code:
2017-08-24 11:22:34 0 [Note] /usr/sbin/mysqld (mysqld 5.6.37) starting as process 29908 ...
2017-08-24 11:22:34 29908 [Note] Plugin 'FEDERATED' is disabled.
2017-08-24 11:22:34 29908 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-08-24 11:22:34 29908 [Note] InnoDB: The InnoDB memory heap is disabled
2017-08-24 11:22:34 29908 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-08-24 11:22:34 29908 [Note] InnoDB: Memory barrier is not used
2017-08-24 11:22:34 29908 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-08-24 11:22:34 29908 [Note] InnoDB: Using Linux native AIO
2017-08-24 11:22:34 29908 [Note] InnoDB: Using CPU crc32 instructions
2017-08-24 11:22:34 29908 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-08-24 11:22:34 29908 [Note] InnoDB: Completed initialization of buffer pool
2017-08-24 11:22:34 29908 [Note] InnoDB: Highest supported file format is Barracuda.
2017-08-24 11:22:34 29908 [Note] InnoDB: Log scan progressed past the checkpoint lsn 52678266336
2017-08-24 11:22:34 29908 [Note] InnoDB: Database was not shutdown normally!
2017-08-24 11:22:34 29908 [Note] InnoDB: Starting crash recovery.
2017-08-24 11:22:34 29908 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-08-24 11:22:34 29908 [Note] InnoDB: Restoring possible half-written data pages
2017-08-24 11:22:34 29908 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 52678807221
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 1 row operations to undo
InnoDB: Trx id counter is 665453568
2017-08-24 11:22:34 29908 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
2017-08-24 11:22:35 29908 [Note] InnoDB: 128 rollback segment(s) are active.
InnoDB: Starting in background the rollback of uncommitted transactions
2017-08-24 11:22:35 7f915a450700  InnoDB: Rolling back trx with id 665396319, 1 rows to undo
2017-08-24 11:22:35 7f915a450700  InnoDB: Assertion failure in thread 140262261458688 in file fut0lst.ic line 83
InnoDB: Failing assertion: addr.page == FIL_NULL || addr.boffset >= FIL_PAGE_DATA
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
18:22:35 UTC - mysqld got signal 6 ;
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=8388608
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68108 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
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 = 0 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x3b)[0x8e7c1b]
2017-08-24 07:55:17 24675 [Note] InnoDB: Waiting for purge to start
/usr/sbin/mysqld(handle_fatal_signal+0x491)[0x674c01]
/lib64/libpthread.so.0(+0xf370)[0x7fa889569370]
/lib64/libc.so.6(gsignal+0x37)[0x7fa88834f1d7]
/lib64/libc.so.6(abort+0x148)[0x7fa8883508c8]
/usr/sbin/mysqld[0x58a584]
/usr/sbin/mysqld[0xa9a1f1]
/usr/sbin/mysqld[0x9e44c2]
/usr/sbin/mysqld[0x9fcca3]
/usr/sbin/mysqld[0x9f46c6]
/usr/sbin/mysqld[0x9f5698]
/usr/sbin/mysqld[0x9edfcf]
/usr/sbin/mysqld[0x9ee591]
/lib64/libpthread.so.0(+0x7dc5)[0x7fa889561dc5]
/lib64/libc.so.6(clone+0x6d)[0x7fa88841176d]
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.
170824 07:55:17 mysqld_safe mysqld from pid file /var/lib/mysql/xxx.xxxxxxx.xxx.pid ended

I eventually found a solution but I'm trying to determine the cause of this issue to avoid this in the future. Here's how I resolved the issue:

1. Add 'innodb_force_recovery=3' to my.cnf
2. Restart mysql - I did a mysqlcheck --all-databases at this point, all came back fine.
3. Create a backup with mysqldump of all databases
4. Drop all databases except information and performance schema and mysql database
5. There were a bunch of stragglers that couldn't be removed, I manually moved their folders out of /var/lib/mysql
6. Deleted the ib* files in /var/lib/mysql
7. Remove 'innodb_force_recovery=3' and restart mysql
8. Import databases