Bug #38766 Falcon hangs during start-up if compiled for 64 bit SPARC
Submitted: 13 Aug 2008 10:31 Modified: 18 Oct 2008 14:12
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.6 OS:Solaris (Solaris 10)
Assigned to: Olav Sandstå CPU Architecture:Any
Tags: Sun Studio

[13 Aug 2008 10:31] Olav Sandstå
Description:
When compiling Falcon for 64 bit SPARC using the Sun Studio 12 compiler, MySQL hangs during startup. One thread is using all CPU (looping). This thread have the following call stack:

  [1] _atomic_cas_64(0x101762cb0, 0x0, 0x1, 0x0, 0x0, 0x0), at 0xffffffff7de386d8 
=>[2] inline_cas_pointer(target = 0x101762cb0, compare = (nil), exchange = 0x1), line 267 in "Interlock.h"
  [3] interlockedAdd(addend = 0x101762cb0, value = 1), line 399 in "Interlock.h"
  [4] SerialLog::updateSectionUseVector(this = 0x101755cf8, sectionId = 2U, tableSpaceId = 0, delta = 1), line 1513 in "SerialLog.cpp"
  [5] SRLUpdateRecords::append(this = 0x10175a8a0, transaction = 0x1017cae98, records = 0x104f0c2b8, chillRecords = false), line 216 in "SRLUpdateRecords.cpp"
  [6] Dbb::logUpdatedRecords(this = 0x1017bf3c8, transaction = 0x1017cae98, records = 0x104f0c2b8, chill = false), line 1244 in "Dbb.cpp"
  [7] Transaction::commit(this = 0x1017cae98), line 266 in "Transaction.cpp"
  [8] Connection::commit(this = 0x1017c04a0), line 272 in "Connection.cpp"
  [9] Database::commitSystemTransaction(this = 0x1015bfb48), line 1255 in "Database.cpp"
  [10] RoleModel::insertPrivilege(this = 0x1017545f8, role = 0x101754ca8, object = 0x10178c130, mask = -1), line 563 in "RoleModel.cpp"
  [11] RoleModel::addUserPrivilege(this = 0x1017545f8, user = 0x101754ca8, object = 0x10178c130, mask = -1), line 364 in "RoleModel.cpp"
  [12] Nfs::Statement::createTable(this = 0x1017c0a30, syntax = 0x1017d6d28), line 228 in "Statement.cpp"
  [13] Nfs::Statement::upgradeTable(this = 0x1017c0a30, syntax = 0x1017d6d28), line 1197 in "Statement.cpp"
  [14] Nfs::Statement::executeDDL(this = 0x1017c0a30), line 740 in "Statement.cpp"
  [15] Nfs::Statement::execute(this = 0x1017c0a30, sqlString = 0x101079c18 "upgrade table system.privileges (holderType tinyint not null,holderSchema varchar (128) not null,holderName varchar (128) not null,objectType tinyint not null,objectSchema varchar (128) not null,objectName varchar (128) not null,privilegeMask integer,primary key (holderType, holderSchema, holderName, objectType, objectSchema, objectName))", isQuery = false), line 2708 in "Statement.cpp"
  [16] Nfs::Statement::execute(this = 0x1017c0a30, sqlString = 0x101079c18 "upgrade table system.privileges (holderType tinyint not null,holderSchema varchar (128) not null,holderName varchar (128) not null,objectType tinyint not null,objectSchema varchar (128) not null,objectName varchar (128) not null,privilegeMask integer,primary key (holderType, holderSchema, holderName, objectType, objectSchema, objectName))"), line 162 in "Statement.cpp"
  [17] Nfs::Statement::executeUpdate(this = 0x1017c0a30, sqlString = 0x101079c18 "upgrade table system.privileges (holderType tinyint not null,holderSchema varchar (128) not null,holderName varchar (128) not null,objectType tinyint not null,objectSchema varchar (128) not null,objectName varchar (128) not null,privilegeMask integer,primary key (holderType, holderSchema, holderName, objectType, objectSchema, objectName))"), line 1083 in "Statement.cpp"
  [18] RoleModel::createTables(this = 0x1017545f8), line 156 in "RoleModel.cpp"
  [19] Database::createDatabase(this = 0x1015bfb48, filename = 0xffffffff7fffe038 "falcon_master.fts"), line 652 in "Database.cpp"
  [20] Connection::createDatabase(this = 0x1017bf130, dbName = 0x1017bee34 "FALCON_MASTER", fileName = 0x1017bee6c "falcon_master.fts", account = 0x10101e1fb "mysql", password = 0x10101e201 "mysql", threads = 0x1017beea0), line 1064 in "Connection.cpp"
  [21] StorageDatabase::createDatabase(this = 0x1017becc0), line 160 in "StorageDatabase.cpp"
  [22] StorageHandler::initialize(this = 0x1015beff8), line 990 in "StorageHandler.cpp"
  [23] StorageInterface::falcon_init(p = 0x1021eae10), line 211 in "ha_falcon.cpp"
  [24] ha_initialize_handlerton(plugin = 0x1019e0170), line 426 in "handler.cc"
  [25] plugin_initialize(plugin = 0x1019e0170), line 1011 in "sql_plugin.cc"
  [26] plugin_init(argc = 0x101340310, argv = 0x1019c2478, flags = 2), line 1218 in "sql_plugin.cc"
  [27] init_server_components(), line 4042 in "mysqld.cc"
  [28] main(argc = 13, argv = 0xffffffff7ffff328), line 4489 in "mysqld.cc"

How to repeat:
1. Compile Falcon for 64 bit SPARC using the Sun Studio 12 compiler

2. Start mysql and it is likely that it will be hanging using all CPU on the machine.
[20 Aug 2008 10:46] Olav Sandstå
The hang also occurs when compiling with gcc for 64 bit SPARC
[21 Aug 2008 11:24] 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/52198

2792 Olav Sandstaa	2008-08-21
      Fix for Bug#38766 Falcon hangs during start-up if compiled for 64 bit SPARC
      
      Wrong CompareAndChange routine was used for in interlockedAdd. Replaced routine for exchanging 
      pointers with routine for exchanging integer values. This problem resultet in errors
      on big-endian 64 bit machines.
[21 Aug 2008 12: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/52205

2792 Olav Sandstaa	2008-08-21
      Fix for Bug#38766 Falcon hangs during start-up if compiled for 64 bit SPARC
      
      Wrong CompareAndChange routine was used for in interlockedAdd. Replaced routine for exchanging 
      pointers with routine for exchanging integer values. This problem resultet in errors
      on big-endian 64 bit machines.
[21 Aug 2008 15:54] 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/52234

2793 Kelly Long	2008-08-21
      Improve page cache at higher concurrency.
      WL4479: Falcon Engine - Page Cache: high concurrency Get Free Buffer
      WL4480: Falcon Engine - Page Cache: hash table lock per bucket
      WL4481: Falcon Engine - Make hash table sizes power of two
[28 Aug 2008 4:33] Bugs System
Pushed into 6.0.7-alpha  (revid:olav@sun.com-20080821112344-6q23hnl1r8gxhe1v) (version source revid:vvaintroub@mysql.com-20080827094944-sh582y3m7duhzrpj) (pib:3)
[14 Sep 2008 2:11] Bugs System
Pushed into 6.0.6-alpha  (revid:olav@sun.com-20080821112344-6q23hnl1r8gxhe1v) (version source revid:hakan@mysql.com-20080716160034-sdexuyp3qow7zlc6) (pib:3)
[18 Oct 2008 14:12] Jon Stephens
Documented bugfix in the 6.0.7 changelog as follows:

        When built with Falcon support on 64-bit SPARC platforms, mysqld hung on
        startup. This occurred whether Sun Studio or gcc was used as the
        compiler.