Circleci/mysql:5.6 Failures

Hello!

We’ve recently started to see random failures of builds due to the circleci/mysql:5.6 container crashing. Our circle configuration has not changed in months and the failures seem to be system related. Here are an example of two recent failures.

In the first example it appears MySQL failed to write to disk:

MySQL init process done. Ready for start up.

2019-05-01 21:32:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-05-01 21:32:53 0 [Note] mysqld (mysqld 5.6.44) starting as process 7 ...
2019-05-01 21:32:53 7 [Note] Plugin 'FEDERATED' is disabled.
2019-05-01 21:32:53 7 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-05-01 21:32:53 7 [Note] InnoDB: The InnoDB memory heap is disabled
2019-05-01 21:32:53 7 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-05-01 21:32:53 7 [Note] InnoDB: Memory barrier is not used
2019-05-01 21:32:53 7 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-05-01 21:32:53 7 [Note] InnoDB: Using CPU crc32 instructions
2019-05-01 21:32:53 7 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-05-01 21:32:53 7 [Note] InnoDB: Completed initialization of buffer pool
2019-05-01 21:32:53 7 [Note] InnoDB: Highest supported file format is Barracuda.
2019-05-01 21:32:53 7 [Note] InnoDB: 128 rollback segment(s) are active.
2019-05-01 21:32:53 7 [Note] InnoDB: Waiting for purge to start
2019-05-01 21:32:53 7 [Note] InnoDB: 5.6.44 started; log sequence number 1625997
2019-05-01 21:32:53 7 [Note] Server hostname (bind-address): '*'; port: 3306
2019-05-01 21:32:53 7 [Note] IPv6 is available.
2019-05-01 21:32:53 7 [Note]   - '::' resolves to '::';
2019-05-01 21:32:53 7 [Note] Server socket created on IP: '::'.
2019-05-01 21:32:53 7 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2019-05-01 21:32:53 7 [Warning] 'proxies_priv' entry '@ root@e84c3826c94e' ignored in --skip-name-resolve mode.
2019-05-01 21:32:53 7 [Note] Event Scheduler: Loaded 0 events
2019-05-01 21:32:53 7 [Note] mysqld: ready for connections.
Version: '5.6.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2019-05-01 21:53:42 7f38a5d5a700 InnoDB: Error: Write to file ./mysql/innodb_index_stats.ibd failed at offset 393216.
InnoDB: 16384 bytes should have been written, only 4096 were written.
InnoDB: Operating system error number 0.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 0 means 'Success'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2019-05-01 21:53:42 7f38a5d5a700  InnoDB: Assertion failure in thread 139881277138688 in file os0file.cc line 5432
InnoDB: Failing assertion: ret
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.
21:53:42 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=2
max_threads=151
thread_count=2
connection_count=2
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68109 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
mysqld(my_print_stacktrace+0x2c)[0x55dabf1f288c]
mysqld(handle_fatal_signal+0x4b1)[0x55dabef8fea1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x110e0)[0x7f38cccb10e0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcf)[0x7f38cb84dfff]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f38cb84f42a]
mysqld(+0x7440dc)[0x55dabf2740dc]
mysqld(+0x84b8a0)[0x55dabf37b8a0]
mysqld(+0x7aa248)[0x55dabf2da248]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x74a4)[0x7f38ccca74a4]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f38cb903d0f]
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.

Exited with code 1

And in the second it appears MySQL ran out of memory:

2019-05-01 18:07:48 25 [Note] mysqld: ready for connections.
Version: '5.6.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2019-05-01 18:37:00 7fe73b9927002019-05-01 18:37:00 25 [ERROR] InnoDB: Failure of system call pwrite(). Operating system error number is 12.
InnoDB: Error number 12 means 'Cannot allocate memory'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2019-05-01 18:37:00 7fe73b992700  InnoDB: Assertion failure in thread 140631114065664 in file os0file.cc line 5432
InnoDB: Failing assertion: ret
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:37:00 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.

Any ideas what may be wrong? I appreciate the help and and give you any more details that may be useful.

Hmm, there are some random Mongo failures over here. I wonder if they are related?

You’ve not posted your YAML config, but I assume you have spun up MySQL as a secondary Docker container. If you are presently stuck, you could instead install it in your build container from the OS repo (something like apt-get install -y mysql-server) and start it manually.

Correct, MySQL is running in its own docker container.

I guessed as much. Let me know how you get on!