Bug #61650 innodb.innodb_bug59641 script cannot pass when build with UNIV_SYNC_DEBUG
Submitted: 27 Jun 2011 6:55 Modified: 30 Jun 2011 20:11
Reporter: Yasufumi Kinoshita Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S3 (Non-critical)
Version:5.5.13 OS:Linux
Assigned to: CPU Architecture:Any

[27 Jun 2011 6:55] Yasufumi Kinoshita
Description:
mysql-test-run innodb.innodb_bug59641
fails with crash when use
#define UNIV_DEBUG
#define UNIV_SYNC_DEBUG
to build InnoDB

How to repeat:
build InnoDB with
#define UNIV_DEBUG
#define UNIV_SYNC_DEBUG

and run innodb.innodb_bug59641 script

----
#0  0x00007f7528d1be7c in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000512918 in handle_segfault (sig=6)
    at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/sql/mysqld.cc:2509
#2  <signal handler called>
#3  0x00007f7527f484e5 in raise () from /lib64/libc.so.6
#4  0x00007f7527f499b0 in abort () from /lib64/libc.so.6
#5  0x0000000000858ecf in sync_thread_add_level (latch=0x1652140, level=600)
    at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/sync/sync0sync.c:1234
#6  0x0000000000858f40 in mutex_set_debug_info (mutex=0x586,
    file_name=0xa9d320 "/home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/trx/trx0undo.c",
    line=1988) at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/sync/sync0sync.c:693
#7  0x0000000000877c1b in mutex_enter_func (file_name=<value optimized out>, line=<value optimized out>,
    mutex=<value optimized out>)
    at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/include/sync0sync.ic:217
#8  pfs_mutex_enter_func (file_name=<value optimized out>, line=<value optimized out>,
    mutex=<value optimized out>)
    at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/include/sync0sync.ic:251
#9  0x000000000087c295 in trx_undo_free_prepared (trx=0x1674678)
    at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/trx/trx0undo.c:1988
#10 0x0000000000876ab0 in trx_free_prepared (trx=0x1674678)
    at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/trx/trx0trx.c:363
#11 0x00000000008711b7 in trx_sys_close ()
    at /home/kinoyasu/patch_repo/work8/mysql-5.5.13_norm/storage/innobase/trx/trx0sys.c:1662
#12 0x0000000000850fef in innobase_shutdown_for_mysql ()
[30 Jun 2011 20:11] Marko Mäkelä
Thanks, Yasufumi.

I have already noticed and fixed this bug by removing any mutex or rw-lock acquisition in trx_undo_free_page(). The fix should be included in our next 5.1 and 5.5 releases.

There should not be any possibility of a deadlock or race condition, because this function is being invoked when InnoDB is executing in single-threaded mode.
[30 Jun 2011 20:56] Marko Mäkelä
I meant trx_undo_free_prepared().