Bug #45186 Select...lock in share mode caused a crash.
Submitted: 29 May 2009 10:48 Modified: 30 Jun 2009 0:14
Reporter: Horst Hunger Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version: 5.1.36-debug OS:Linux (suse-linux-gnu on i686)
Assigned to: CPU Architecture:Any

[29 May 2009 10:48] Horst Hunger
Description:
The following query let the server crash in 5.1 (executable successfully in 5.0):

SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE

See the backtrace:

Core generated by '/work/bzr/mysql-5.1-bugteam/sql/mysqld'
Output from gdb follows. The first stack trace is from the failing thread.
The following stack traces are from all threads (so the failing one is
duplicated).
--------------------------
Using host libthread_db library "/lib/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Core was generated by `/work/bzr/mysql-5.1-bugteam/sql/mysqld --defaults-group-suffix=.1 --defaults-fi'.
Program terminated with signal 6, Aborted.
#0  0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7fab397 in pthread_kill () from /lib/libpthread.so.0
#2  0x086f4245 in my_write_core (sig=6) at stacktrace.c:310
#3  0x082bdeff in handle_segfault (sig=6) at mysqld.cc:2536
#4  <signal handler called>
#5  0xffffe410 in __kernel_vsyscall ()
#6  0xb7e118f5 in raise () from /lib/libc.so.6
#7  0xb7e131e1 in abort () from /lib/libc.so.6
#8  0x08574682 in row_unlock_for_mysql (prebuilt=0xb73a3c68, has_latches_on_recs=0)
    at row/row0mysql.c:1534
#9  0x08510fec in ha_innobase::unlock_row (this=0x8f76078) at handler/ha_innodb.cc:4187
#10 0x0833b227 in evaluate_join_record (join=0x8f74be8, join_tab=0x8f8cdc8, error=0)
    at sql_select.cc:11270
#11 0x0833b388 in sub_select (join=0x8f74be8, join_tab=0x8f8cdc8, end_of_records=false)
    at sql_select.cc:11137
#12 0x0834b924 in do_select (join=0x8f74be8, fields=0x8f1d530, table=0x0, procedure=0x0)
    at sql_select.cc:10887
#13 0x0835c0fc in JOIN::exec (this=0x8f74be8) at sql_select.cc:2199
#14 0x08357054 in mysql_select (thd=0x8f1c0f8, rref_pointer_array=0x8f1d594, tables=0x8f742a0,
    wild_num=0, fields=@0x8f1d530, conds=0x8f74ab8, og_num=0, order=0x0, group=0x0, having=0x0,
    proc_param=0x0, select_options=2148289024, result=0x8f74bd0, unit=0x8f1d22c,
    select_lex=0x8f1d49c) at sql_select.cc:2386
#15 0x0835c42f in handle_select (thd=0x8f1c0f8, lex=0x8f1d1d0, result=0x8f74bd0,
    setup_tables_done_option=0) at sql_select.cc:268
#16 0x082cd871 in execute_sqlcom_select (thd=0x8f1c0f8, all_tables=0x8f742a0)
    at sql_parse.cc:5011
#17 0x082cf87e in mysql_execute_command (thd=0x8f1c0f8) at sql_parse.cc:2208
#18 0x082d8a80 in mysql_parse (thd=0x8f1c0f8,
    inBuf=0x8f74048 "SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE", length=75, found_semicolon=0xb379b26c) at sql_parse.cc:5931
#19 0x082d96bb in dispatch_command (command=COM_QUERY, thd=0x8f1c0f8, packet=0x8f61129 "",
    packet_length=75) at sql_parse.cc:1213
#20 0x082da899 in do_command (thd=0x8f1c0f8) at sql_parse.cc:854
#21 0x082c7179 in handle_one_connection (arg=0x8f1c0f8) at sql_connect.cc:1115
#22 0xb7fa6192 in start_thread () from /lib/libpthread.so.0
#23 0xb7eab02e in clone () from /lib/libc.so.6

How to repeat:
Execute the attached test with mtr (create a result file with touch).
[29 May 2009 10:49] Horst Hunger
test to reproduce the bug and a complete backtrace (dump).

Attachment: innodb_row_lock_4_crash.test (application/octet-stream, text), 1.15 KiB.

[29 May 2009 11:16] Horst Hunger
In azalea the attached test run successfully.
[31 May 2009 0:14] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior with 5.1-main. Which tree do you use?
[1 Jul 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".