Bug #69926 MySQL crash on disk full with mysqld got signal 11
Submitted: 5 Aug 2013 10:40 Modified: 5 Dec 2019 7:10
Reporter: Dan Rimal Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:5.1 , 5.5, 5.6, 5.6.46 OS:Linux
Assigned to: CPU Architecture:Any

[5 Aug 2013 10:40] Dan Rimal
Description:
I have had ramdisk for "tmpdir". While temporary table use more space than available on tmpdir and query is killed, mysql will crash with "mysqld got signal 11"

For example, generic testing table:

MariaDB [cswiki]> show create table langlinks\G;
       Table: langlinks
Create Table: CREATE TABLE `langlinks` (
  `ll_from` int(8) unsigned NOT NULL DEFAULT '0',
  `ll_lang` varbinary(20) NOT NULL DEFAULT '',
  `ll_title` varbinary(255) NOT NULL DEFAULT '',
  UNIQUE KEY `ll_from` (`ll_from`,`ll_lang`),
  KEY `ll_lang` (`ll_lang`,`ll_title`)
) ENGINE=MyISAM DEFAULT CHARSET=ascii COMMENT='Denni prehledy poctu nabidek podle licenci'
1 row in set (0.00 sec)

CREATE TEMPORARY TABLE IF NOT EXISTS TEMPTABLES.test LIKE langlinks;

INSERT INTO  TEMPTABLES.test SELECT t.ll_from, t.ll_lang, t.ll_title from langlinks t;

Now, free space is exhausted and i have got:

130801 16:28:31 [ERROR] mysqld: Incorrect key file for table '/tmp/#sql6ecc_2_0.MYI'; try to repair it
130801 16:28:31 [ERROR] Got an error from unknown thread, /home/buildbot/buildbot/build/mariadb-5.5.32/storage/myisam/mi_write.c:224
130801 16:28:31 [Warning] mysqld: Disk is full writing '/tmp/#sql6ecc_2_0.MYI' (Errcode: 28). Waiting for someone to free space... (Expect up to 60 secs delay for server to continue after freeing disk space)
130801 16:28:31 [Warning] mysqld: Retry in 60 secs. Message reprinted in 600 secs

Now, i killed query by ctrl+c and everything seems ok. But, exactly one minutes after space exhaustion, db crashed with trace:

130801 16:29:31 [ERROR] 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.

To report this bug, see http://kb.askmonty.org/en/reporting-bugs

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.

Server version: 5.5.32-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=3
max_threads=153
thread_count=2
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 466714 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0x2632990
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 = 0x7ff3580b3d78 thread_stack 0x48000
??:0(my_print_stacktrace)[0xa8631e]
??:0(handle_fatal_signal)[0x6cdd0b]
??:0(??)[0x7ff35d973500]
??:0(flush_key_blocks_int)[0xa74856]
??:0(flush_simple_key_cache_blocks)[0xa75a41]
??:0(mi_repair_by_sort)[0xa21c96]
??:0(ha_myisam::repair(THD*, st_handler_check_param&, bool))[0xa15cba]
??:0(ha_myisam::enable_indexes(unsigned int))[0xa15e71]
??:0(ha_myisam::end_bulk_insert())[0xa12be9]
??:0(select_insert::abort_result_set())[0x56e475]
??:0(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5d9ddf]
??:0(mysql_execute_command(THD*))[0x58d849]
??:0(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x58e369]
??:0(dispatch_command(enum_server_command, THD*, char*, unsigned int))[0x58f790]
??:0(do_handle_one_connection(THD*))[0x647cdf]
??:0(handle_one_connection)[0x647d7c]
??:0(??)[0x7ff35d96b851]
??:0(??)[0x7ff35c2df90d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7ff328004bd8): is an invalid pointer
Connection ID (thread ID): 2
Status: KILL_QUERY

Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
{noformat}

This was purely testing environment with almost empty config file, but on production environment on 5.5.31 is the same problem.

How to repeat:
The scenario is as initially described:

- load data into a temporary table while there is not enough space in tmp left;
- wait until it hits the error (in the log file)

130805 3:32:19 [Warning] mysqld: Disk is full writing '/data/smalldisk/#sqlb62_2_0.MYI' (Errcode: 28). Waiting for someone to free space... (Expect up to 60 secs delay for server to continue after freeing disk space)
130805 3:32:19 [Warning] mysqld: Retry in 60 secs. Message reprinted in 600 secs

- kill the query (it's better to do kill query <thread id> from another session rather than Ctrl-C, it's more reliable);
- make sure the processlist says that the query is killed;
- wait till another 60-sec checkpoint happens
  => get the assertion failure.
[5 Aug 2013 10:44] Dan Rimal
Also reproducible on MySQL 5.1, 5.6 (on 5.6 the assertion is slightly different, but otherwise the result is the same).
[7 Aug 2013 6:38] MySQL Verification Team
Hello Dan,

Thank you for the bug report. 
Duplicate of internally reported bug #13498489

Thanks,
Umesh
[5 Dec 2013 1:28] Jervin R
I would like to add that the crash would only happen if the temporary table is MyISAM. Based on my tests, if this is InnoDB instead, even after killing the query and you were not able to free up disk space, the server does not crash.
[5 Dec 2019 7:10] MySQL Verification Team
While working on another bug, able to reproduce this on 5.6.46 build.

regards,
Umesh
[5 Dec 2019 7:11] MySQL Verification Team
Test results - 5.6.46

Attachment: 69926_5.6.46.results (application/octet-stream, text), 15.25 KiB.

[23 Dec 2019 4:20] MySQL Verification Team
With the exact steps(default server settings) I'm not seeing any issues(such as with 5.6.46) on 5.7.28(attempted only once). I'll give it a try again and update here if able to reproduce.
[27 Jun 2022 18:23] MySQL Verification Team
Bug#107632 is marked as duplicate of this one