Description:
when disk space is full, the myisamchk will be crash. I think this bug will occur in every mysql client command.
stack when crashed:
Reading symbols from /usr/local/mysql-5.6.16/bin/myisamchk...done.
[New LWP 40127]
warning: Can't read pathname for load map: Input/output error.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/local/mysql-5.6.16/bin/myisamchk -rq -a -S -s NewUser20100527'.
Program terminated with signal 11, Segmentation fault.
 0x0000000000000000 in ?? ()
(gdb) bt
 0x0000000000000000 in ?? ()
 0x0000000000460e7c in my_printf_warning (format=<optimized out>) at /home/mysql/soft/mysql-5.6.16/mysys/my_error.c:260
 0x000000000046c814 in wait_for_free_space (filename=0xdb4d00 "/tmp/STSSztkl", errors=errors@entry=0)
at /home/mysql/soft/mysql-5.6.16/mysys/errors.c:115
 0x00000000004667b9 in my_write (Filedes=Filedes@entry=5, Buffer=0xdaacf0 "\021", <incomplete sequence \222>, Buffer@entry=0xda4cf0 "]",
Count=40960, Count@entry=65536, MyFlags=MyFlags@entry=52) at /home/mysql/soft/mysql-5.6.16/mysys/my_write.c:68
 0x000000000045426d in inline_mysql_file_write (flags=52, count=65536, buffer=0xda4cf0 "]", file=5, src_line=1788, src_file=<optimized out>)
at /home/mysql/soft/mysql-5.6.16/include/mysql/psi/mysql_file.h:1141
 my_b_flush_io_cache (info=info@entry=0x7fffff89afb0, need_append_buffer_lock=<optimized out>, need_append_buffer_lock@entry=1)
at /home/mysql/soft/mysql-5.6.16/mysys/mf_iocache.c:1787
 0x0000000000454600 in _my_b_write (info=0x7fffff89afb0, Buffer=0x7f56748d4b05 "", Count=11)
at /home/mysql/soft/mysql-5.6.16/mysys/mf_iocache.c:1556
 0x000000000044224f in write_keys (info=info@entry=0x7fffff89ba70, sort_keys=0x7f56747cba88, sort_keys@entry=0x7f567473f010,
count=count@entry=90685, buffpek=<optimized out>, tempfile=tempfile@entry=0x7fffff89afb0)
at /home/mysql/soft/mysql-5.6.16/storage/myisam/sort.c:670
 0x00000000004438ca in find_all_keys (tempfile_for_exceptions=0x7fffff89b0d0, tempfile=0x7fffff89afb0, maxbuffer=0x7fffff89af70,
buffpek=0x7fffff89af90, sort_keys=0x7f567473f010, keys=90686, info=0x7fffff89ba70) at /home/mysql/soft/mysql-5.6.16/storage/myisam/sort.c:283
 _create_index_by_sort (info=0x7f56747f01f8, info@entry=0x7fffff89ba70, no_messages=1 '\001', sortbuff_size=<optimized out>)
at /home/mysql/soft/mysql-5.6.16/storage/myisam/sort.c:189
0x000000000041452d in mi_repair_by_sort (param=param@entry=0x97e920, info=0xd85a90, name=name@entry=0x7fffff89c928 "NewUser20100527",
rep_quick=rep_quick@entry=32768) at /home/mysql/soft/mysql-5.6.16/storage/myisam/mi_check.c:2436
0x000000000040cb78 in myisamchk (filename=0x7fffff89c928 "NewUser20100527", param=0x97e920)
at /home/mysql/soft/mysql-5.6.16/storage/myisam/myisamchk.c:998
0x00000000004095a2 in main (argc=0, argv=0xd83328) at /home/mysql/soft/mysql-5.6.16/storage/myisam/myisamchk.c:94
reason:
in my_printf_warning(), sql_print_warning_hook isn't inited when run myisamchk.
~/source/bzr/mysql-server/mysql-5.6 $ grep -r sql_print_warning_hook
include/my_sys.h:extern void(*sql_print_warning_hook)(const char *format,...);
mysys/my_error.c:void(*sql_print_warning_hook)(const char *format,...);
mysys/my_error.c: (*sql_print_warning_hook)(wbuff);
sql/mysqld.cc: sql_print_warning_hook = sql_print_warning;
it seems only inited in mysql server side code.
in include/my_sys.h:
extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
myf MyFlags);
extern void(*sql_print_warning_hook)(const char *format,...);
extern uint my_file_limit;
extern ulong my_thread_stack_size;
extern void (*proc_info_hook)(void *, const PSI_stage_info *, PSI_stage_info *,
const char *, const char *, const unsigned int);
there are some hook variables, maybe also have this problem.
How to repeat:
1. test when disk is full
2. read code
Suggested fix:
initial the hook variable using a comman function when using the mysys library.