Bug #56448 Assertion failed: ! is_set() with second xa end
Submitted: 1 Sep 2010 13:36 Modified: 17 Nov 2010 1:22
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S1 (Critical)
Version:5.5+ OS:Any
Assigned to: Jon Olav Hauglid CPU Architecture:Any
Tags: regression

[1 Sep 2010 13:36] Shane Bester
Description:
Version: '5.6.0-m4-debug'  socket: ''  port: 3306  MySQL Community Server - Debug (GPL)
Assertion failed: ! is_set(), file ..\..\mysql-5.6.0-m4\sql\sql_error.cc, line 359

 my_sigabrt_handler()[my_thr_init.c:519]
 raise()[winsig.c:597]
 abort()[abort.c:78]
 _wassert()[assert.c:163]
 Diagnostics_area::set_ok_status()[sql_error.cc:359]
 my_ok()[sql_class.h:2894]
 mysql_execute_command()[sql_parse.cc:4523]
 mysql_parse()[sql_parse.cc:5828]
 dispatch_command()[sql_parse.cc:1132]
 do_command()[sql_parse.cc:801]
 do_handle_one_connection()[sql_connect.cc:1191]
 handle_one_connection()[sql_connect.cc:1131]
 pthread_start()[my_winthread.c:62]
 _callthreadstartex()[threadex.c:348]
 _threadstartex()[threadex.c:331]
 BaseThreadStart()

How to repeat:
on debug build:

xa start 'x'; 
xa end 'x'; 
xa end 'x';
[1 Sep 2010 13:43] Valeriy Kravchuk
Verified just as described. Also - with current mysql-next-mr from bzr on Mac OS X:

macbook-pro:next-mr openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.99-m5-debug Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> xa start 'x'; 
Query OK, 0 rows affected (0.01 sec)

mysql> xa end 'x'; 
Query OK, 0 rows affected (0.00 sec)

mysql> xa end 'x';
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 100901 16:41:31 mysqld_safe mysqld restarted

mysql> exit
Bye
macbook-pro:next-mr openxs$ tail -50 var/macbook-pro.err 
Assertion failed: (! is_set()), function set_ok_status, file sql_error.cc, line 359.
...
[1 Sep 2010 13:53] Valeriy Kravchuk
Indeed, happens with current mysql-5.5 from bzr also:

macbook-pro:5.5 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.7-m3-debug Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> xa start 'x'; 
Query OK, 0 rows affected (0.00 sec)

mysql> xa end 'x'; 
Query OK, 0 rows affected (0.00 sec)

mysql> xa end 'x';
ERROR 2013 (HY000): Lost connection to MySQL server during query
[13 Sep 2010 9:25] 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/118057

3136 Jon Olav Hauglid	2010-09-13
      Bug #56448 Assertion failed: ! is_set() with second xa end
      
      The problem was that issuing XA END when the XA transaction was
      already ended, caused an assertion. This assertion tests that 
      the server does not try to send OK to the client if there has
      already been an error reported. The bug was only noticeable on
      debug versions of the server.
      
      The reason for the problem was that the trans_xa_end() function
      reported success if the transaction was at XA_IDLE state at the
      end regardless of any errors occured during processing of
      trans_xa_end(). So if the transaction state was XA_IDLE already,
      reported errors would be ignored.
      
      This patch fixes the problem by having trans_xa_end() take into
      consideration any reported errors.
      
      Test case added to xa.test.
[13 Sep 2010 11: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/118069

3136 Jon Olav Hauglid	2010-09-13
      Bug #56448 Assertion failed: ! is_set() with second xa end
      
      The problem was that issuing XA END when the XA transaction was
      already ended, caused an assertion. This assertion tests that 
      the server does not try to send OK to the client if there has
      already been an error reported. The bug was only noticeable on
      debug versions of the server.
      
      The reason for the problem was that the trans_xa_end() function
      reported success if the transaction was at XA_IDLE state at the
      end regardless of any errors occured during processing of
      trans_xa_end(). So if the transaction state was XA_IDLE already,
      reported errors would be ignored.
      
      This patch fixes the problem by having trans_xa_end() take into
      consideration any reported errors. The patch also fixes a similar
      bug with XA PREPARE.
      
      Test case added to xa.test.
[15 Sep 2010 7:38] Jon Olav Hauglid
Pushed to mysql-5.5-runtime (5.5.7-m3).
[9 Nov 2010 19:46] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (merge vers: 5.1.50) (pib:21)
[12 Nov 2010 0:41] Paul DuBois
Noted in 5.5.7 changelog.

Executing XA END after an XA transaction was already ended raised an
assertion.
[13 Nov 2010 16:14] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (merge vers: 5.1.50) (pib:21)
[13 Nov 2010 16:37] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (pib:21)