Bug #42429 Falcon crash in Table::checkUniqueRecordVersion

Submitted: 28 Jan 2009 16:35 Modified: 7 May 2009 16:58
Reporter: Kevin Lewis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.9 OS:Any
Assigned to: Kevin Lewis CPU Architecture:Any
Tags: F_RECORD TREE

[28 Jan 2009 16:35] Kevin Lewis
Description:
While testing with RQG I found the following crash;

 	Transaction::getRelativeState(record=0x07a3fba8, flags=1)  Line 802
	Table::checkUniqueRecordVersion(recordNumber=11059, index=0x0419cba0, transaction=0x042cb3c0, record=0x07a3f738, syncUnique=0x0749df5c)  Line 2625
 	Table::checkUniqueIndex(index=0x0419cba0, transaction=0x042cb3c0, record=0x07a3f738, sync=0x0749df5c)  Line 2510
 	Table::insertIndexes(transaction=0x042cb3c0, record=0x07a3f738)  Line 1268 
 	Table::insert(transaction=0x042cb3c0, stream=0x040e7190)  Line 3056
 	StorageDatabase::insert(connection=0x041f2ed0, table=0x040bf878, stream=0x040e7190)  Line 267
 	StorageTable::insert()  Line 109
 	StorageInterface::write_row(buff=0x02a2ad48)  Line 1159 
 	ha_write_row(buf=0x02a2ad48)  Line 5438
 	. . .

It crashed in the following call to getRelativeState();

   if (isDuplicate(index, record, dup))
      {
      if (state == Active)
         {
         syncPrior.unlock(); // release lock before wait
         syncUnique->unlock(); // release lock before wait

         // Wait for that transaction, then restart checkUniqueIndexes()

>>>      state = transaction->getRelativeState(dup, WAIT_IF_ACTIVE);  <<<

After syncPrior was unlocked, the record version 'dup' was scavenged, probably by a commit doing releaseSavepoint or something.  By the time the debugger had stopped all threads, the memory location for dup had been reused for a completely different record number.  But while dup was free, it crashed in getRelativeState() at this line;
>>>	if (!record->isVersion())   <<<

How to repeat:
I was running this RQG script;
perl runall.pl --rows=1000 --threads=4 --mask=1487 --queries=1000000 --duration=3000 --basedir=C:\Work\bzr\Chg-09\mysql-6.0-falcon-team --engine=Falcon --grammar=conf/combinations.yy --gendata=conf/combinations.zz --reporter=ErrorLog,Backtrace

Suggested fix:
Records on the prior record chain will not be deleted while the checkUniqueRecordVersion() thread has the lock on syncPrior, but if it is release, that thread should have a useCount added.
[28 Jan 2009 16:37] Kevin Lewis
Verified by catching it in debugger.
[28 Jan 2009 21:06] Kevin Lewis
See http://lists.mysql.com/commits/64375

2983 Kevin Lewis	2009-01-28
      Bug #42429-Falcon crash in Table::checkUniqueRecordVersion
      increment the useCount for dup so it does not go away 
      immediately releasing syncPrior.
modified:
  storage/falcon/Table.cpp
[13 Feb 2009 7:24] Bugs System
Pushed into 6.0.10-alpha (revid:alik@sun.com-20090211182317-uagkyj01fk30p1f8) (version source revid:kevin.lewis@sun.com-20090128191944-s2smemptgdxn17bf) (merge vers: 6.0.10-alpha) (pib:6)
[7 May 2009 16:58] MC Brown
Internal/test fix. No changelog entry required.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.