Bug #43171 Assertion failed: thd->transaction.xid_state.xid.is_null()
Submitted: 25 Feb 2009 8:46 Modified: 18 Dec 2009 13:24
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Locking Severity:S2 (Serious)
Version:5.1.32-debug, 5.1.34-debug, 5.1.39-debug, 5.1.41-debug OS:Any
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: assert, xid

[25 Feb 2009 8:46] Shane Bester
Looks like bug #28323 but that should have been fixed already.
During long running multithreaded transaction tests, this crash occurred:

0086EB9A    mysqld.exe!movelink()[hash.c:272]                         
0086EA64    mysqld.exe!my_hash_insert()[hash.c:437]                   
00659858    mysqld.exe!xid_cache_insert()[sql_class.cc:3120]          
006989F6    mysqld.exe!mysql_execute_command()[sql_parse.cc:4580]     
0069C8C7    mysqld.exe!mysql_parse()[sql_parse.cc:5810]               
00690E7E    mysqld.exe!dispatch_command()[sql_parse.cc:1216]          
006904F4    mysqld.exe!do_command()[sql_parse.cc:857]                 
007AEC06    mysqld.exe!handle_one_connection()[sql_connect.cc:1115]   
008813E6    mysqld.exe!pthread_start()[my_winthread.c:85]             
00A02FC1    mysqld.exe!_callthreadstart()[thread.c:293]               
00A02F67    mysqld.exe!_threadstart()[thread.c:277]                   
7D4DFFF1    kernel32.dll!FlsSetValue()                                
Trying to get some variables.                                         
Some pointers may be invalid and cause the dump to abort...           
thd->query at 0DEEB028=xa start 'xid1'                                

Crash is on this line:
while ((next_link=old_link->next) != find);           

dereferencing old_link pointer caused:
Access violation reading location 0x04fd5c00

How to repeat:
no easy testcase. will try make one if this happens again.
[25 Feb 2009 8:50] MySQL Verification Team
extra info about the crash. this is not good enough for a testcase yet.

Attachment: bug43171_some_extra_infos.txt (text/plain), 43.13 KiB.

[16 Jun 2009 9:12] MySQL Verification Team
seen again today on 5.1.34 on windows:

00683772    mysqld.exe!my_hash_sort_bin()[ctype-bin.c:309]
0063C1A3    mysqld.exe!calc_hash()[hash.c:45]
0063C315    mysqld.exe!my_hash_rec_mask()[hash.c:171]
0063C6E4    mysqld.exe!my_hash_first()[hash.c:226]
0063C9A9    mysqld.exe!my_hash_search()[hash.c:193]
00531C49    mysqld.exe!xid_cache_search()[sql_class.cc:3104]
00558720    mysqld.exe!mysql_execute_command()[sql_parse.cc:4706]
0055A133    mysqld.exe!mysql_parse()[sql_parse.cc:5906]
0055AC23    mysqld.exe!dispatch_command()[sql_parse.cc:1218]
0055BA27    mysqld.exe!do_command()[sql_parse.cc:861]
005DEC81    mysqld.exe!handle_one_connection()[sql_connect.cc:1115]
00644D1B    mysqld.exe!pthread_start()[my_winthread.c:85]
0072A1A3    mysqld.exe!_callthreadstart()[thread.c:293]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 169F0030=xa commit 'xid1'
[14 Oct 2009 20:05] MySQL Verification Team
Got a testcase for 5.1.39-debug:

Version: '5.1.39-enterprise-gpl-advanced-debug'  socket: ''  port: 3306  MySQL Enterprise Server - Advanced Edition Debug (GPL)
091014 22:05:23 [ERROR] mysqld-debug: Deadlock found when trying to get lock; try restarting transaction
091014 22:05:23 [ERROR] mysqld-debug: Sort aborted
Assertion failed: thd->transaction.xid_state.xid.is_null(), file .\sql_parse.cc, line 4677

 invalid and cause the dump to abort...
thd->query at 0000000012131A68=xa start 'xid1'

Will upload a .c file.
[14 Oct 2009 20:14] MySQL Verification Team
testcase. run against a debug build.

Attachment: bug43171.c (text/x-csrc), 7.54 KiB.

[14 Oct 2009 20:16] MySQL Verification Team
I guess this is a followup to already fixed bug #44672
[15 Oct 2009 3:50] Valeriy Kravchuk
Verified just as described with recent 5.1.41 from bzr on Mac OS X. I've got the same assertion:

Assertion failed: (thd->transaction.xid_state.xid.is_null()), function unknown function, file sql_parse.cc, line 4709.
091015  6:47:45 - mysqld got signal 6 ;
[28 Oct 2009 15:39] 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:


3197 Sergey Vojtovich	2009-10-28
      BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
      XA START may cause assertion failure/server crash when it is called
      after unilateral roll back issued by the Resource Manager (both
      in regular transaction and after XA transaction).
      The problem was that rm_error variable wasn't set/reset properly.
     @ mysql-test/r/xa.result
        A test case for BUG#43171.
     @ mysql-test/t/xa.test
        A test case for BUG#43171.
     @ sql/handler.cc
        Setting rm_error when we're out of XA transaction has no
        special meaning. But it blocks reset of thd->transaction.xid
        structure later.
     @ sql/sql_parse.cc
        Reset rm_error before we enter ha_rollback(), so
        thd->transaction.xid strucure is reinitialized.
[31 Oct 2009 10:51] 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:


3171 Sergey Vojtovich	2009-10-31 [merge]
      Merge fix for BUG#43171.
[1 Nov 2009 8:55] 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:


3660 Sergey Vojtovich	2009-11-01 [merge]
      Merge fix for BUG#43171 mysql-5.1-bugteam => mysql-pe.
[4 Nov 2009 9:25] Bugs System
Pushed into 5.1.41 (revid:joro@sun.com-20091104092152-qz96bzlf2o1japwc) (version source revid:kristofer.pettersson@sun.com-20091103162305-08l4gkeuif2ozsoj) (merge vers: 5.1.41) (pib:13)
[11 Nov 2009 6:51] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091110093407-rw5g8dys2baqkt67) (version source revid:alik@sun.com-20091109080109-7dxapd5y5pxlu08w) (merge vers: 6.0.14-alpha) (pib:13)
[11 Nov 2009 6:59] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091109115615-nuohp02h8mdrz8m2) (version source revid:alik@sun.com-20091105093814-s4fnrbdbbez3zrs3) (merge vers: 5.5.0-beta) (pib:13)
[17 Nov 2009 16:55] Paul Dubois
Noted in 5.1.41, 5.5.0, 6.0.14 changelogs.

XA START could cause an assertion failure or server crash when it is
called after a unilateral rollback issued by the Resource Manager
(both in a regular transaction and after an XA transaction).
[18 Dec 2009 10:27] Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:43] Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 10:58] Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:13] Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)
[18 Dec 2009 13:24] MC Brown
Already noted in earlier changelogs.