| Bug #58709 | assert in mysql_execute_command | ||
|---|---|---|---|
| Submitted: | 3 Dec 2010 16:44 | Modified: | 24 Mar 2011 22:45 |
| Reporter: | Matthias Leich | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Stored Routines | Severity: | S3 (Non-critical) |
| Version: | 5.6.1-m5-debug-log | OS: | Any |
| Assigned to: | Jon Olav Hauglid | CPU Architecture: | Any |
| Tags: | assert, prepared statement, PROCEDURE | ||
[3 Dec 2010 17:17]
Valeriy Kravchuk
Verified just as described with current mysql-trunk tree on Mac OS X: macbook-pro:mysql-test openxs$ ./mtr bug58709 Logging: ./mtr bug58709 101203 19:16:03 [Warning] Setting lower_case_table_names=2 because file system for /var/folders/dX/dXCzvuSlHX4Op1g-o1jIWk+++TI/-Tmp-/Tmt6lBi0mZ/ is case insensitive 101203 19:16:03 [Note] Plugin 'FEDERATED' is disabled. 101203 19:16:03 [Note] Plugin 'ndbcluster' is disabled. MySQL Version 5.6.1 Checking supported features... - skipping ndbcluster - SSL connections supported - binaries are debug compiled Collecting tests... vardir: /Users/openxs/dbs/trunk/mysql-test/var Checking leftover processes... Removing old var directory... Creating var directory '/Users/openxs/dbs/trunk/mysql-test/var'... Installing system database... Using server port 59309 ============================================================================== TEST RESULT TIME (ms) ------------------------------------------------------------ worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009 main.bug58709 [ fail ] Test ended at 2010-12-03 19:16:19 CURRENT_TEST: main.bug58709 mysqltest: At line 19: query 'EXECUTE stm' failed: 2013: Lost connection to MySQL server during query The result from queries just before the failure was: DROP TABLE IF EXISTS t2, t1; DROP PROCEDURE IF EXISTS proc1; CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; CREATE TABLE t2 ( i INT NOT NULL, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION ) ENGINE= InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); CREATE PROCEDURE proc1() DELETE IGNORE FROM t1 WHERE i = 1; PREPARE stm FROM 'CALL proc1()'; Server [mysqld.1 - pid: 25582, winpid: 25582, exit: 256] failed during test run Server log from this test: ----------SERVER LOG START----------- 101203 20:16:11 [Warning] Setting lower_case_table_names=2 because file system for /Users/openxs/dbs/trunk/mysql-test/var/mysqld.1/data/ is case insensitive 101203 20:16:11 [Note] Plugin 'FEDERATED' is disabled. 101203 20:16:11 [Note] Plugin 'ndbcluster' is disabled. InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 101203 20:16:11 InnoDB: Initializing buffer pool, size = 8.0M 101203 20:16:11 InnoDB: Completed initialization of buffer pool 101203 20:16:11 InnoDB: highest supported file format is Barracuda. 101203 20:16:11 InnoDB: 1.2.0 started; log sequence number 1595675 101203 20:16:11 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 06af6e7c-ff01-11df-ac5d-28e8129fe7a9. 101203 20:16:11 [Note] Event Scheduler: Loaded 0 events 101203 20:16:11 [Note] /Users/openxs/dbs/trunk/libexec/mysqld: ready for connections. Version: '5.6.1-m5-debug-log' socket: '/Users/openxs/dbs/trunk/mysql-test/var/tmp/mysqld.1.sock' port: 13000 Source distribution Assertion failed: (thd->is_error() || thd->killed), function mysql_execute_command, file sql_parse.cc, line 3973. 101203 20:16:12 - mysqld got signal 6 ; ...
[19 Jan 2011 9:58]
Jon Olav Hauglid
Prepared statement is not needed to reproduce. Simply doing CALL proc1() is enough.
[19 Jan 2011 12:12]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/129173 3532 Jon Olav Hauglid 2011-01-19 Bug #58709 assert in mysql_execute_command The triggered assert checks that either an error has been reported or the statement has been killed if execution of a stored routine fails. It was triggered if a stored routine had a DELETE IGNORE statement which failed but due to IGNORE had not reported any error. This patch fixes the problem by changing mysql_delete() to return a value indicating failure only if an error has been reported or the statement has been killed. Test case added to delete.test.
[2 Feb 2011 10:33]
Bugs System
Pushed into mysql-trunk 5.6.2 (revid:jon.hauglid@oracle.com-20110202103221-y9rsy95eujvyjx4u) (version source revid:jon.hauglid@oracle.com-20110202103221-y9rsy95eujvyjx4u) (merge vers: 5.6.2) (pib:24)
[2 Feb 2011 10:33]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/130197 3590 Jon Olav Hauglid 2011-02-02 Bug #58709 assert in mysql_execute_command The triggered assert checks that either an error has been reported or the statement has been killed if execution of a stored routine fails. It was triggered if a stored routine had a DELETE IGNORE statement which failed but due to IGNORE had not reported any error. This patch fixes the problem by changing mysql_delete() to return a value indicating failure only if an error has been reported or the statement has been killed. Test case added to delete.test.
[24 Mar 2011 22:45]
Paul DuBois
Noted in 5.6.2 changelog. An assertion was raised if a stored routine had a DELETE IGNORE statement that failed but due to the IGNORE had not reported any error. CHANGESET - http://lists.mysql.com/commits/130197

Description: The assert happens in sql/sql_parse.cc line 3989 if (!res) { my_ok(thd, (thd->get_row_count_func() < 0) ? 0 : thd->get_row_count_func()); } else { DBUG_ASSERT(thd->is_error() || thd->killed); <========= goto error; // Substatement should already have sent error } Result on on mysql-trunk-stage revno: 3209 2010-11-30 -------------------------------------------------- ... main.ml102 [ fail ] Test ended at 2010-12-03 17:33:32 CURRENT_TEST: main.ml102 mysqltest: At line 18: query 'EXECUTE stm' failed: 2013: Lost connection to MySQL server during query ... mysqld: sql/sql_parse.cc:3989: int mysql_execute_command(THD*): Assertion `thd->is_error() || thd->killed' failed. 101203 19:33:32 - mysqld got signal 6 ; ... Thread 1 (Thread 23905): #0 0x00007f569b1025ec in pthread_kill () from /lib64/libpthread.so.0 #1 0x0000000000b0b690 in my_write_core (sig=6) at /work2/repo/mysql-trunk-stage/mysys/stacktrace.c:330 #2 0x000000000058b622 in handle_segfault (sig=6) at /work2/repo/mysql-trunk-stage/sql/mysqld.cc:2511 #3 <signal handler called> #4 0x00007f569a1119e5 in raise () from /lib64/libc.so.6 #5 0x00007f569a112ee6 in abort () from /lib64/libc.so.6 #6 0x00007f569a10a235 in __assert_fail () from /lib64/libc.so.6 #7 0x000000000061996d in mysql_execute_command (thd=0x1ba6930) at sql/sql_parse.cc:3989 #8 0x0000000000632e6f in Prepared_statement::execute (this=0x1c2d240, expanded_query=0x7f569b382140, open_cursor=false) at sql/sql_prepare.cc:3772 #9 0x0000000000631f63 in Prepared_statement::execute_loop (this=0x1c2d240, expanded_query=0x7f569b382140, open_cursor=false, packet=0x0, packet_end=0x0) at sql/sql_prepare.cc:3425 #10 0x0000000000630312 in mysql_sql_stmt_execute (thd=0x1ba6930) at sql/sql_prepare.cc:2626 #11 0x00000000006142f7 in mysql_execute_command (thd=0x1ba6930) at sql/sql_parse.cc:2118 #12 0x000000000061d56a in mysql_parse (thd=0x1ba6930, rawbuf=0x1bf0ff0 "EXECUTE stm", length=11, parser_state=0x7f569b3836e0) at sql/sql_parse.cc:5553 #13 0x0000000000611bc1 in dispatch_command (command=COM_QUERY, thd=0x1ba6930, packet=0x1bfc9d1 "EXECUTE stm", packet_length=11) at sql/sql_parse.cc:1072 #14 0x0000000000611215 in do_command (thd=0x1ba6930) at sql/sql_parse.cc:812 #15 0x00000000006f164a in do_handle_one_connection (thd_arg=0x1ba6930) at sql/sql_connect.cc:745 #16 0x00000000006f1484 in handle_one_connection (arg=0x1ba6930) at sql/sql_connect.cc:684 #17 0x0000000000a46128 in pfs_spawn_thread (arg=0x1be1de0) at storage/perfschema/pfs.cc:1360 #18 0x00007f569b0fca4f in start_thread () from /lib64/libpthread.so.0 #19 0x00007f569a1af82d in clone () from /lib64/libc.so.6 #20 0x0000000000000000 in ?? () Content of ml102.test --------------------------------- -- source include/have_innodb.inc --disable_warnings DROP TABLE IF EXISTS t2, t1; DROP PROCEDURE IF EXISTS proc1; --enable_warnings CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; CREATE TABLE t2 ( i INT NOT NULL, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION ) ENGINE= InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); CREATE PROCEDURE proc1() DELETE IGNORE FROM t1 WHERE i = 1; PREPARE stm FROM 'CALL proc1()'; ######## HERE COMES THE ASSERT ########### EXECUTE stm; # Cleanup DROP TABLE t2; DROP TABLE t1; DROP PROCEDURE proc1; How to repeat: For content of ml102.test see above. ./mysql-test-run.pl ml102