Bug #3807 FLUSH LOG Crashing server
Submitted: 18 May 2004 4:21 Modified: 18 May 2004 10:28
Reporter: Roberto Spadim (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.1-nt/4.1.2/Suse 9.0 OS:Windows (WINDOWS XP PROFESSIONAL)
Assigned to: Sergei Golubchik CPU Architecture:Any

[18 May 2004 4:21] Roberto Spadim
Description:
FLUSH LOGS crash server, the problem occur on the same server that have bugID #3720 the mensage of windows is 
"mysql-nt.exe encountered a problem and needs to close. We are sorry for the incovenience" the visual c++ 6.0 debug shows...
CALL STACK:
MYSQLD-NT! 004f3e05()
FAST-WATCH:
name                        value
004f3e05                    CXX0013: Error: Missing operator
004f3f0c                    CXX0013: Error: Missing operator
REGISTERS:
 EAX = 00000000 EBX = 00000000 ECX = 0072BD60 EDX = 0072BD78
 ESI = 0072BE40 EDI = 00000000 EIP = 004F3E05 ESP = 0202F5F4
 EBP = 00000000 EFL = 00000246 CS = 001B DS = 0023 ES = 0023
 SS = 0023 FS = 0038 GS = 0000 OV=0 UP=0 EI=1 PL=0 ZR=1 AC=0
 PE=1 CY=0 ST0 = +0.00000000000000000e+0000
 ST1 = +0.00000000000000000e+0000
 ST2 = -0.03607263668611311e+2629
 ST3 = +0.00000000000000000e+0000
 ST4 = +0.00000000000000000e+0000
 ST5 = +0.00000000000000000e+0000
 ST6 = +0.00000000000000000e+0000
 ST7 = +1.70000000000000000e+0001 CTRL = 027F STAT = 0120
 TAGS = FFFF EIP = 00000000 CS = 0000 DS = 0000 EDO = 00000000
DISASSEMBLY
004F3DEB   mov         ebx,dword ptr [esi]
004F3DED   jb          004F3E92
004F3DF3   ja          004F3DFF
004F3DF5   cmp         dword ptr [esp+1Ch],ebx
004F3DF9   jb          004F3E92
004F3DFF   mov         edi,dword ptr [esi+30h]
004F3E02   mov         eax,dword ptr [esi+1Ch]
CURSOR STOPPED HERE==>>>004F3E05   mov         edx,dword ptr [edi]
004F3E07   sub         edx,eax
004F3E09   xor         ecx,ecx
004F3E0B   add         edx,ebx
004F3E0D   mov         ebx,dword ptr [esp+20h]

How to repeat:
FLUSH LOGS on WINDOWS XP mysqld-nt 4.1.1 (from the mysql download page)
[18 May 2004 4:50] Roberto Spadim
my.ini:

[mysqld]
skip-innodb
basedir=D:/mysqld/4_1_1
datadir=D:/mysqld/4_1_1/data
#log-slow-queries=d:/mysqld/4_1_1/slow.queries
#log=d:/mysqld/4_1_1/log.txt
default-character-set=latin1
default-collation=latin1_swedish_ci

set-variable	= log_error=
set-variable	= expire_logs_days=5
set-variable	= long_query_time=2
set-variable	= table_cache=64
set-variable	= max_allowed_packet=1M
set-variable 	= slow_launch_time=3
set-variable 	= max_relay_log_size=512K
set-variable 	= query_cache_size=8M
set-variable 	= query_cache_limit=8M
[WinMySQLadmin]
Server=D:/mysqld/4_1_1/bin/mysqld-nt.exe
QueryInterval=10
[18 May 2004 6:00] MySQL Verification Team
Thank you for the bug report I was able to repeat.
The crash happens when exists the below configuration key:

set-variable	= expire_logs_days=5

/mf_iocache.c
^--303--
  /* If the whole file is in memory, avoid flushing to disk */
  if (! clear_cache &&
      seek_offset >= info->pos_in_file &&
      seek_offset <= my_b_tell(info))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

CALL STACK

>	mysqld.exe!reinit_io_cache(st_io_cache * info=0x008dab68, int type=0, unsigned __int64 seek_offset=0, int use_async_io=0, int clear_cache=0)  Line 306 + 0x38	C
 	mysqld.exe!MYSQL_LOG::find_log_pos(st_log_info * linfo=0x0302f048, const char * log_name=0x00000000, int need_lock=0)  Line 459 + 0x19	C++
 	mysqld.exe!MYSQL_LOG::purge_logs_before_date(long purge_time=1084420532)  Line 860 + 0x16	C++
 	mysqld.exe!reload_acl_and_cache(THD * thd=0x00d98e88, unsigned long options=2, st_table_list * tables=0x00000000, int * write_to_binlog=0x0302f3b4)  Line 4620	C++
 	mysqld.exe!mysql_execute_command(THD * thd=0x00d98e88)  Line 3242 + 0x1e	C++
 	mysqld.exe!mysql_parse(THD * thd=0x00d98e88, char * inBuf=0x00d9e668, unsigned int length=10)  Line 3887 + 0x9	C++
 	mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x00d98e88, char * packet=0x00d9a601, unsigned int packet_length=11)  Line 1457 + 0x1d	C++
 	mysqld.exe!do_command(THD * thd=0x00d98e88)  Line 1272 + 0x31	C++
 	mysqld.exe!handle_one_connection(void * arg=0x00d98e88)  Line 1016 + 0x9	C++
 	mysqld.exe!pthread_start(void * param=0x00d9a548)  Line 63 + 0x7	C
 	mysqld.exe!_threadstart(void * ptd=0x00da1e18)  Line 173 + 0xd	C
 	kernel32.dll!77e6d33b() 	

  {
[18 May 2004 6:36] MySQL Verification Team
Adding Suse Linux:

/usr/local/mysql/libexec/mysqld: ready for connections.
Version: '4.1.2-alpha'  socket: '/tmp/mysql.sock'  port: 3306
[New Thread 147466 (LWP 16235)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 147466 (LWP 16235)]
0x083bd383 in reinit_io_cache ()
(gdb)  backtrace full
#0  0x083bd383 in reinit_io_cache ()
No symbol table info available.
#1  0x081c888a in MYSQL_LOG::purge_logs_before_date(long) ()
No symbol table info available.
#2  0x08181fb6 in reload_acl_and_cache(THD*, unsigned long, st_table_list*, bool*) ()
No symbol table info available.
#3  0x0817b8fe in mysql_execute_command(THD*) ()
No symbol table info available.
#4  0x08180739 in mysql_parse(THD*, char*, unsigned) ()
No symbol table info available.
#5  0x0817a621 in dispatch_command(enum_server_command, THD*, char*, unsigned) ()
No symbol table info available.
#6  0x08179bb7 in do_command(THD*) ()
No symbol table info available.
#7  0x0817919e in handle_one_connection ()
No symbol table info available.
#8  0x40170f60 in pthread_start_thread () from /lib/i686/libpthread.so.0
No symbol table info available.
#9  0x401710fe in pthread_start_thread_event () from /lib/i686/libpthread.so.0
No symbol table info available.
#10 0x403db327 in clone () from /lib/i686/libc.so.6
No symbol table info available.
[18 May 2004 10:28] Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

fixed, the fix will be in 4.1.3

the crash happens because you have binary logging disabled, but want your binlog to be rotated every 5 days (expire_logs_days=5)