Bug #27895 Falcon: crash if new database and interleaving transactions
Submitted: 17 Apr 2007 16:51 Modified: 26 Apr 2007 11:01
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S1 (Critical)
Version:6.0.0-falcon-alpha-debug OS:Linux (SUSE 10 64-bit)
Assigned to: CPU Architecture:Any

[17 Apr 2007 16:51] Peter Gulutzan
Description:
I install a new data directory with mysql_install_db.
I start mysqld.
On one connection, I create Falcon table and start a transaction.
On another connection, I insert into the table.
Crash.

How to repeat:
Destroy all files on datadir, for example with "rm -R *
Recreate the datadir, for example with "mysql_install_db"

Start mysqld.

Start two mysql client connections. Call them T1 and T2.

On T1, say:
set @@autocommit=0;
use test;
drop database falcon4; /* No problem if not exists. */
create database falcon4;
use falcon4;
create table t2 (s1 int, s2 varchar(10)) engine=falcon;
insert into t2 values (1,'w');
create index i2 on t2 (s1, s2);
commit;
select s1, s2 from t2 where s2 = 'w';
insert into t2 values (12, 'w');

On T2, say:
set @@autocommit=0;
use falcon4
start transaction;
insert into t2 values (2,'b');

At this point, mysqld should crash.
[17 Apr 2007 17:30] MySQL Verification Team
Thank you for the bug report. Verified as described on FC 6 32-bit.

T2>use falcon4
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
T2>start transaction;
Query OK, 0 rows affected (0.00 sec)

T2>insert into t2 values (2,'b');
ERROR 2013 (HY000): Lost connection to MySQL server during query
[17 Apr 2007 18:46] Hakan Küçükyılmaz
Clean SIGSEV

(gdb) p storageConnection
$1 = (class StorageConnection *) 0x0

Backtrace 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1158465888 (LWP 16430)]
0x000000000078c120 in NfsStorageTable::external_lock (this=0xe4b648, thd=0xe88708, lock_type=1)
    at ha_falcon.cpp:1526
1526                            if (storageConnection->startTransaction(thd->variables.tx_isolation))
(gdb) bt
#0  0x000000000078c120 in NfsStorageTable::external_lock (this=0xe4b648, thd=0xe88708, lock_type=1)
    at ha_falcon.cpp:1526
#1  0x00000000006e4659 in handler::ha_external_lock (this=0xe4b648, thd=0xe88708, lock_type=1)
    at handler.cc:3610
#2  0x0000000000601337 in lock_external (thd=0xe88708, tables=<value optimized out>, count=1)
    at lock.cc:261
#3  0x0000000000601f3a in mysql_lock_tables (thd=0xe88708, tables=0xe930c8, count=1, flags=4,
    need_reopen=0x450cab97) at lock.cc:172
#4  0x000000000064b512 in lock_tables (thd=0xe88708, tables=0xe92c10, count=<value optimized out>,
    need_reopen=0x450cab97) at sql_base.cc:3640
#5  0x000000000065305a in open_and_lock_tables (thd=0xe88708, tables=0xe92c10) at sql_base.cc:3483
#6  0x0000000000686751 in mysql_insert (thd=0xe88708, table_list=0xe92c10, fields=@0xe8a530,
    values_list=@0xe8a578, update_fields=@0xe8a560, update_values=@0xe8a548, duplic=DUP_ERROR,
    ignore=false) at sql_insert.cc:464
#7  0x000000000061b881 in mysql_execute_command (thd=0xe88708) at sql_parse.cc:2643
#8  0x000000000061c0df in mysql_parse (thd=0xe88708, inBuf=0xe92b58 "insert into t2 values (2,'b')",
    length=<value optimized out>) at sql_parse.cc:5274
#9  0x000000000061ccbb in dispatch_command (command=COM_QUERY, thd=0xe88708,
    packet=<value optimized out>, packet_length=30) at sql_parse.cc:896
#10 0x000000000061dbac in do_command (thd=0xe88708) at sql_parse.cc:662
#11 0x000000000060f82e in handle_one_connection (arg=<value optimized out>) at sql_connect.cc:1089
#12 0x00002b9de0f40f1a in start_thread () from /lib/libpthread.so.0
#13 0x00002b9de15f5602 in clone () from /lib/libc.so.6
[17 Apr 2007 19:17] Hakan Küçükyılmaz
Added test case falcon_bug_27895.test and pushed into 5.1-falcon tree.
[17 Apr 2007 19:19] 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/24702

ChangeSet@1.2602, 2007-04-17 21:18:47+02:00, hakank@lu0011.wdf.sap.corp +3 -0
  Test for Bug#27895.
[17 Apr 2007 19:29] Hakan Küçükyılmaz
Dear bug system,

a test was pushed for this bug, not a patch.

Best regards,

Hakan
[19 Apr 2007 23:10] Hakan Küçükyılmaz
Crash is gone, but now data is missing:

hakan@lu0011:~/work/mysql/mysql-5.1-falcon/mysql-test$ ./mysql-test-run.pl --enable-disabled falcon_bug_27895Logging: ./mysql-test-run.pl --enable-disabled falcon_bug_27895
MySQL Version 6.0.0
Using binlog format 'mixed'
Skipping ndbcluster, mysqld not compiled with ndbcluster
Setting mysqld to support SSL connections
Binaries are debug compiled
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using IM_PORT               = 9312
Using IM_MYSQLD1_PORT       = 9313
Using IM_MYSQLD2_PORT       = 9314
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
Installing Master Database
Installing Master Database
=======================================================
Starting Tests in the 'main' suite

Test(s) which will be run though they are marked as disabled:
  falcon_bug_27895     : Bug#27895 2007-04-17 hakank Currently failing

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

falcon_bug_27895               [ fail ]

ERROR: Bug#27895 2007-04-17 hakank Currently failing
Below are the diffs between actual and expected results:
-------------------------------------------------------
*** r/falcon_bug_27895.result   2007-04-17 22:18:45.000000000 +0300
--- r/falcon_bug_27895.reject   2007-04-20 02:09:51.000000000 +0300
***************
*** 25,30 ****
  COMMIT;
  SELECT count(*) FROM t1;
  count(*)
! 3
  DROP SCHEMA db1;
  USE test;
--- 25,30 ----
  COMMIT;
  SELECT count(*) FROM t1;
  count(*)
! 1
  DROP SCHEMA db1;
  USE test;
-------------------------------------------------------
Please follow the instructions outlined at
http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html
to find the reason to this problem and how to report this.

Related to Bug#27767
[20 Apr 2007 18:40] Hakan Küçükyılmaz
Test passes now

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

falcon_bug_27895               [ pass ]           1322
-------------------------------------------------------
Stopping All Servers
All 1 tests were successful.
The servers where restarted 1 times
Spent 1.322 seconds actually executing testcases
[26 Apr 2007 11:01] MC Brown
A note has been added to the 6.0.0 changelog.