Bug #23587 MySQL 5.0.26 RPM Server Crash on Redhat Linux ES3 running a Store Procedure
Submitted: 24 Oct 2006 16:25 Modified: 31 Oct 2006 9:45
Reporter: Michael Franklin Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.26 OS:Linux (Red Hat Enterprise Linux ES rele)
Assigned to: CPU Architecture:Any

[24 Oct 2006 16:25] Michael Franklin
Description:

We are having a stack crash for MySQL rpm version 

MySQL-client-standard-5.0.26-0.rhel3
MySQL-standard-debuginfo-5.0.26-0.rhel3
MySQL-server-standard-5.0.26-0.rhel3

When we run a store procedure of:

=============================================
CALL sp_NewMortgageBusiness ('2006-01-01','2006-09-01',-1,-1,-1,-1,'N',-1,2,-1,-1,'ApplRecd',-1,-1,-1);

=====================================================

This sp_NewMortgageBusiness contains the sql functions.

Attached to Case::
=====================================================

The stack fault crash is below.

[root@db1 mysql]# /usr/bin/resolve_stack_dump -s ./mysqld.sym -n mysqld.stack
0x8182780 handle_segfault + 416
0x20a005 (?)
0x2090fd (?)
0x83b7333 my_malloc + 35
0x83b7a0c alloc_root + 220
0x81c09da _Z7openfrmP3THDPKcS2_jjjP8st_table + 2506
0x81bade6 _Z17open_unireg_entryP3THDP8st_tablePKcS4_S4_P13st_table_listP11st_mem_rootj + 150
0x81ba013 _Z10open_tableP3THDP13st_table_listP11st_mem_rootPbj + 2051
0x81bb5d6 _Z11open_tablesP3THDPP13st_table_listPjj + 566
0x81bb978 _Z20open_and_lock_tablesP3THDP13st_table_list + 56
0x81987e9 _Z21mysql_execute_commandP3THD + 585
0x828a6e1 _ZN13sp_instr_stmt9exec_coreEP3THDPj + 17
0x828a489 _ZN13sp_lex_keeper23reset_lex_and_exec_coreEP3THDPjbP8sp_instr + 345
0x828a5c5 _ZN13sp_instr_stmt7executeEP3THDPj + 213
0x8287c2c _ZN7sp_head7executeEP3THD + 812
0x8288cbb _ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE + 795
0x819d5c7 _Z21mysql_execute_commandP3THD + 20519

How to repeat:
If you create the store procedure then run it, it crashes MySQL 5.0.26

Suggested fix:
????
MySQL development ?
[24 Oct 2006 16:27] Michael Franklin
Store_procedure_sp_NewMortgageBusiness.sql

Attachment: sp_NewMortgageBusiness.sql (text/plain), 13.97 KiB.

[24 Oct 2006 16:29] Michael Franklin
This is a RPM 5.0.26 Server Crash for RedHat Enterprise 3 linux
[24 Oct 2006 16:42] MySQL Verification Team
Thank you for the bug report. Could you please provide a complete test case
with table definitions and data if needed to run the stored procedure you
had provided. Thanks in advance.
[25 Oct 2006 8:12] Michael Franklin
I have attached the database "dbd_demo1_ver_4_2_0" as a .sql file. (You will see this in the attached file section.
This file is actually tgz which you will have to unzip first. Then you will see the .sql file.

To test you will have to go into mysql and create the database dbd_demo1_ver_4_2_0 and then import the .sql file into this database.
You can do this as per the instruction below.
>mysql -uroot -p dbd_demo1_ver_4_2_0 < ./dbd_demo1_ver_4_2_0.sql

You will have to create the procedure and then execute the procedure with the command 
CALL sp_NewMortgageBusiness ('2006-01-01','2006-09-01',-1,-1,-1,-1,'N',-1,2,-1,-1,'ApplRecd',-1,-1,-1);

I Also get this MySQL 5.x crash with version 5.0.22 (Bin / source), 5.0.24a (bin / Source) and the latest version 5.0.26 (bin / source and RPM )
We have tested MySQL 5.0.26 (RPM / source) under Redhat Linux ES4 and it works fine.
[25 Oct 2006 8:15] Michael Franklin
Store Procedure

Attachment: sp_NewMortgageBusiness.sql (text/plain), 13.97 KiB.

[25 Oct 2006 8:57] Michael Franklin
Test Database

Attachment: dbd_demo1_ver_4_2_0.zip (application/x-zip-compressed, text), 193.05 KiB.

[25 Oct 2006 19:37] Sveta Smirnova
Michael,

could you please confirm or refuse if you use NPTL threads?
[25 Oct 2006 20:09] Sveta Smirnova
I've just tried to repeat the issue on the Red Hat Linux Advanced Server 3 (AMD 64) without success.

Please also provide your my.cnf file and indicate if you use 32-bit or 64-bit processor.
[27 Oct 2006 8:24] Michael Franklin
My NPTL is version 
  getconf GNU_LIBPTHREAD_VERSION
NPTL 0.60

#pwd
/lib/tls
# ./libc.so.6
GNU C Library stable release version 2.3.2, by Roland McGrath et al.
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.2.3 20030502 (Red Hat Linux 3.2.3-54).
Compiled on a Linux 2.4.20 system on 2006-06-16.
Available extensions:
        GNU libio by Per Bothner
        crypt add-on version 2.1 by Michael Glad and others
        NPTL 0.60 by Ulrich Drepper
        RT using linux kernel aio
        The C stubs add-on version 2.1.2.
        BIND-8.2.3-T5B
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
        Glibc-2.0 compatibility add-on by Cristian Gafton
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

]# /lib/libc.so.6
GNU C Library stable release version 2.3.2, by Roland McGrath et al.
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.2.3 20030502 (Red Hat Linux 3.2.3-54).
Compiled on a Linux 2.4.20 system on 2006-06-16.
Available extensions:
        GNU libio by Per Bothner
        crypt add-on version 2.1 by Michael Glad and others
        linuxthreads-0.10 by Xavier Leroy
        The C stubs add-on version 2.1.2.
        BIND-8.2.3-T5B
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
        Glibc-2.0 compatibility add-on by Cristian Gafton
        libthread_db work sponsored by Alpha Processor Inc
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

==========================================
We are currently on a 32 Bit Dual Intel 3.0GHz processors.
[27 Oct 2006 8:28] Michael Franklin
MySQL my.cnf file under /etc
==============================================
 Example MySQL config file for large systems.
#
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password       = your_password
port            = 3306
socket          = /var/lib/mysql/mysql5.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql5.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql5-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
#server-id      = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/
#log-update     = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 64M
#bdb_max_lock = 100000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 256M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 64M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
#max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
[27 Oct 2006 20:47] Sveta Smirnova
Thank you for the feedback.

I still can't repeat the issue.

Please, also provide information how much RAM do you have?
[30 Oct 2006 9:03] Michael Franklin
This Server has 2GB of RAM.
[31 Oct 2006 9:45] Sveta Smirnova
Michael, I used to tests neares version of RedHat I can find:

$uname -a
Linux rhas3-x86.mysql.com 2.4.21-32.EL #1 Fri Apr 15 21:17:56 EDT 2005 i686 athl
on i386 GNU/Linux

and I still can't repeat the problem. So I'll close this report as "Can't repeat". If you have ideas how to repeat it simple reopen bug.