Bug #4985 MySQL 4.0 doesn't work with grant tables from MySQL 5.0
Submitted: 11 Aug 2004 0:09 Modified: 25 Aug 2004 18:56
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:4.0 OS:
Assigned to: Konstantin Osipov CPU Architecture:Any

[11 Aug 2004 0:09] Konstantin Osipov
Description:
I recently was upgrading grant tables to 5.0 format using mysql_fix_privilege_tables.sh
script. Since then mysql-4.0 fails to start when using these grant tables.
This is the output I'm getting from the server:

kostja@dragonfly:~/mysql/mysql-4.0-root> sql/mysqld   
040810 15:07:48  Warning: setrlimit could not change the size of core files to 'infinity';  We may not be able to generate a core file on signals
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.
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=8388600
read_buffer_size=131072
max_used_connections=0
max_connections=100
threads_connected=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 225791 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at (nil)  is invalid pointer
thd->thread_id=0
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file
zsh: 9933 segmentation fault (core dumped)  sql/mysqld

The segmentation fault happens inside acl_init, when reading field 28 from some grant table.

How to repeat:
Run MySQL 4.0 server with data directory containing new grant tables.

Suggested fix:
Fix 5.0 tables to not make 4.0 server crash
[11 Aug 2004 1:24] Konstantin Osipov
kostja@dragonfly:~/mysql/mysql-4.0-4937> gdb sql/mysqld
GNU gdb 5.3.92
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...
(gdb) b 'mysql_execute_command'
Breakpoint 1 at 0x8121c88: file sql_parse.cc, line 1332.
(gdb) run
Starting program: /media/sda1/mysql/mysql-4.0-4937/sql/mysqld 
[New Thread 16384 (LWP 10499)]
040810 16:23:44  Warning: setrlimit could not change the size of core files to 'infinity';  We may not be able to generate a core file on signals
[New Thread 32769 (LWP 10505)]
[New Thread 16386 (LWP 10506)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 10499)]
0x40252567 in __strtol_internal () from /lib/libc.so.6
(gdb) bt
#0  0x40252567 in __strtol_internal () from /lib/libc.so.6
#1  0x0816dd3c in acl_init(THD*, bool) (org_thd=0x0, dont_read_acl_tables=168)
    at stdlib.h:316
#2  0x08114972 in main (argc=11, argv=0x83fd3f0) at mysqld.cc:2496
(gdb)
[11 Aug 2004 8:53] Sergei Golubchik
I fixed it for a while in 4.1
Feel free to backport to 4.0
[25 Aug 2004 18:56] Brian Aker
We support going from 5.0 -> 4.1, but not to 4.0.