Description:
MySQL 4.1.12 Community Edition, RPM from mysql.com
Red Hat Enterprise Linux 2.1 ES (kernel 2.4.9-e.59smp)
When running a query of the form:
UPDATE a
INNER JOIN (
SELECT a.c
FROM a INNER JOIN b USING (c)
) AS subquery
USING (c)
SET a.c2 = a.c;
The query runs fine on the master, and if run directly via client on the slave. However, if the query is allowed to replicate to the slave (i.e. it runs on the slave via the slave thread), the slave server crashes with the segmentation fault.
The above is the simplest case we were able to reduce our original query to and still have it crash. The original query was of the form:
UPDATE a
INNER JOIN (
SELECT a.c, COUNT(*) AS num_c
FROM a INNER JOIN b USING (c)
GROUP BY a.c
) AS subquery
USING (c)
SET c_count = subquery.num_c;
It appears to crash when updating a column other than the one used for the JOIN condition.
Here is the output into the error log (stack trace resolved via resolve_stack_dump):
------------------------------------------------------------------------------------------------------
050607 15:11:29 mysqld restarted
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=33554432
read_buffer_size=1044480
max_used_connections=2
max_connections=25
threads_connected=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 160667 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
thd=0x897cba8
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=0xbfe3ef18, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x808df77 init_common_variables__FPCciPPcPPCc + 391
0x82e8af8 lseek + 8
0x80ba663 setup_conds__FP3THDP13st_table_listPP4Item + 1715
0x80beb5f optimize__4JOIN + 1455
0x812f6ef exec__18st_select_lex_unit + 2543
0x8130c7d read_one_row + 29
0x8130bbb cli_read_rows + 443
0x80da90e do_updates__12multi_updateb + 158
0x80a47e1 create_table_precheck__FP3THDP13st_table_listT1 + 289
0x809e0f5 mysql_execute_command__FP3THD + 2869
0x80a2c9f add_field_to_list__FP3THDPc16enum_field_typesT1T1UiP4ItemT6P13st_lex_stringT1Pt4List1Z6StringP15charset_info_stUi + 2447
0x80e34f3 exec_event__14Load_log_eventP6st_netP17st_relay_log_infob + 419
0x812a649 process_io_create_file__FP14st_master_infoP21Create_file_log_event + 793
0x812b3ad next_event__FP17st_relay_log_info + 957
0x82e62ac pthread_getschedparam + 108
0x830fc3a getservbyname + 154
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 0x895606c = UPDATE a
INNER JOIN (
SELECT a.c
FROM a INNER JOIN b USING (c)
) AS subquery
USING (c)
SET a.c2 = a.c
thd->thread_id=4
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
050607 15:11:29 mysqld restarted
-----------------------------------------------------------------------------------------------------
How to repeat:
In a replication environment, set up the following tables:
DROP TABLE IF EXISTS a;
DROP TABLE IF EXISTS b;
CREATE TABLE a (
c INT,
c2 INT
);
CREATE TABLE b (
c INT
);
INSERT a VALUES(1,NULL);
INSERT b VALUES(1);
Execute the following query on the master. It should run properly on the master but crash the slave upon replication:
UPDATE a
INNER JOIN (
SELECT a.c
FROM a INNER JOIN b USING (c)
) AS subquery
USING (c)
SET a.c2 = a.c;
Alternatively:
UPDATE a
INNER JOIN (
SELECT a.c, COUNT(*) AS num_c
FROM a INNER JOIN b USING (c)
GROUP BY a.c
) AS subquery
USING (c)
SET c2 = subquery.num_c;