Bug #17037 handle_segfault on delete statement
Submitted: 2 Feb 2006 13:23 Modified: 9 Mar 2006 14:31
Reporter: Artem Prysyazhnuk Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.18 OS:Linux (RHEL R3 (Kernel 2.6.15.1))
Assigned to: CPU Architecture:Any

[2 Feb 2006 13:23] Artem Prysyazhnuk
Description:
Hello,

A have next problem after update from 4.1.11 to 5.0.18, on high load server down with next messages in mysql.err:

Version: '5.0.18-standard-log'  socket: '/var/lib/mysql/mysql.sock'  port: 0  MySQL Community Edition - Standard (GPL)
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=134217728
read_buffer_size=1044480
max_used_connections=6
max_connections=50
threads_connected=3
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 233271 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x86156d8
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...
Cannot determine thread, fp=0xaddc5e9c, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x815bbb0
0xb7fc0e48
(nil)
0x8174a38
0x825abc1
0x825a959
0x825aaa5
0x8258336
0x82591df
0x8175929
0x825abc1
0x825a959
0x825aaa5
0x8258336
0x82591df
0x8175929
0x8178360
0x816f4a3
0x816efdd
0x816e52e
0xb7fbade8
0xb7ef393a

New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do 
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x86a9bf8 = delete e FROM shedule e LEFT JOIN events_to_pres p ON 
                e.event_id = p.event_id
            WHERE p.event_id IS NULL AND 
            e.event_id between from_id AND to_id
thd->thread_id=9
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.

Number of processes running now: 0
060202 06:53:02  mysqld restarted

-----------------------------------------------------
Resolved stack trace: 

0x815bbb0 handle_segfault + 416
0xb7fc0e48 _end + -1348125032
(nil)
0x8174a38 _Z21mysql_execute_commandP3THD + 16072
0x825abc1 _ZN13sp_instr_stmt9exec_coreEP3THDPj + 17
0x825a959 _ZN13sp_lex_keeper23reset_lex_and_exec_coreEP3THDPjbP8sp_instr + 329
0x825aaa5 _ZN13sp_instr_stmt7executeEP3THDPj + 213
0x8258336 _ZN7sp_head7executeEP3THD + 774
0x82591df _ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE + 991
0x8175929 _Z21mysql_execute_commandP3THD + 19897
0x825abc1 _ZN13sp_instr_stmt9exec_coreEP3THDPj + 17
0x825a959 _ZN13sp_lex_keeper23reset_lex_and_exec_coreEP3THDPjbP8sp_instr + 329
0x825aaa5 _ZN13sp_instr_stmt7executeEP3THDPj + 213
0x8258336 _ZN7sp_head7executeEP3THD + 774
0x82591df _ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE + 991
0x8175929 _Z21mysql_execute_commandP3THD + 19897
0x8178360 _Z11mysql_parseP3THDPcj + 304
0x816f4a3 _Z16dispatch_command19enum_server_commandP3THDPcj + 1139
0x816efdd _Z10do_commandP3THD + 141
0x816e52e handle_one_connection + 638
0xb7fbade8 _end + -1348149704
0xb7ef393a _end + -1348966006

my.cnf ----------------------------
[mysqld]
#innodb_data_file_path=ibdata1:10M:autoextend
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
#bind-address=127.0.0.1
#bind-address=64.246.22.200
thread_stack=128K
#log-slow-queries=/var/log/mysql-slow-queries.log
long-query-time=1
log-error=/var/log/mysql.err
log=/var/log/mysql.log
#log-bin
#binlog-do-db=host_track
server-id=1
skip-networking

connect_timeout=15
interactive_timeout=100000
join_buffer_size=1M
key_buffer=128M
bulk_insert_buffer_size=20M
max_allowed_packet=16M
max_connections=50
max_connect_errors=11
myisam_sort_buffer_size=64M
read_buffer_size=1M
read_rnd_buffer_size=768K
sort_buffer_size=1M
table_cache=1024
thread_cache_size=100
thread_concurrency=2
wait_timeout=300
query_cache_size=32M
query_cache_limit=1M
query_cache_type=1
skip-innodb

How to repeat:
Problem raised on high load. With 4.1.11 this problem not raised.
[2 Feb 2006 13:37] Valeriy Kravchuk
Thank you for a problem report. Please, send the SHOW CREATE TABLE and SHOW TABLE STATUS results for the tables in that DELETE statement. Describe your upgrade procedure. Did you perform dump and restore, as recommended?
[2 Feb 2006 23:16] Artem Prysyazhnuk
This delete statement execute from stored procedure. One table events_to_pres is temp and created in SP.

CREATE TEMPORARY TABLE events_to_pres
          ( event_id int primary key ) ENGINE = MEMORY;

Second table :

CREATE TABLE `shedule` (
  `event_id` int(11) NOT NULL auto_increment,
  `task_id` int(11) NOT NULL default '0',
  `event_user_id` int(11) NOT NULL default '0',
  `first_fail_event_id` int(11) NOT NULL default '-1',
  `fail_event_ord` int(11) NOT NULL default '0',
  `shost_id` int(11) NOT NULL default '0',
  `request_start_time` double NOT NULL default '-1',
  `prev_event_id` int(11) NOT NULL default '-1',
  `prev_request_start_time` double NOT NULL default '-1',
  `request_done_time` double NOT NULL default '-1',
  `response_time` double NOT NULL default '-1',
  `status` enum('skipped','wait','ok','error') NOT NULL default 'wait',
  `ext_status_id` int(11) NOT NULL default '-1',
  `size` int(11) NOT NULL default '-1',
  `check_backward_link` enum('true','false') NOT NULL default 'false',
  `notify_sent` enum('error_notify','recovery_notify','none') NOT NULL default 'none',
  PRIMARY KEY  (`event_id`),
  KEY `task_id_time` (`task_id`,`request_start_time`),
  KEY `request_start_time` (`request_start_time`,`task_id`),
  KEY `request_start_time_3` (`request_start_time`,`prev_request_start_time`),
  KEY `status` (`status`),
  KEY `task_id` (`task_id`,`first_fail_event_id`),
  KEY `first_fail_event_id` (`first_fail_event_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

> Describe your upgrade procedure.

rpm -Uhv Mysql-*
mysql_fix_privilege_tables 

> Did you perform dump and restore, as recommended?

Initially I not make full backup/restore. But after your post I make full dump for my database and restore it. After that problem raised again.
[2 Feb 2006 23:30] Artem Prysyazhnuk
mysql> show table status like "shedule";
+---------+--------+---------+------------+--------+----------------+-------------+-------------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| Name    | Engine | Version | Row_format | Rows   | Avg_row_length | Data_length | Max_data_length   | Index_length | Data_free | Auto_increment | Create_time         | Update_time         | Check_time          | Collation         | Checksum | Create_options | Comment |
+---------+--------+---------+------------+--------+----------------+-------------+-------------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| shedule | MyISAM |      10 | Fixed      | 576948 |             72 |    41540256 | 20266198323167231 |     43907072 |         0 |      220305231 | 2006-02-02 12:28:13 | 2006-02-02 17:29:50 | 2006-02-02 16:27:04 | latin1_swedish_ci |     NULL |                |         |
+---------+--------+---------+------------+--------+----------------+-------------+-------------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
1 row in set (0.00 sec)
[9 Feb 2006 14:31] Valeriy Kravchuk
So, if you create these 2 tables in 5.0.18 and put some sample data in them you'll also get that crash, right? Please, try and inform about the results.

Please, send also the results of

select count(*) FROM shedule e 
LEFT JOIN events_to_pres p ON
e.event_id = p.event_id
WHERE p.event_id IS NULL AND 
e.event_id between from_id AND to_id

and EXPLAIN for this statement (on original tables).
[10 Mar 2006 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".