Bug #45257 innodb_file_per_table make MySQL server crash.
Submitted: 2 Jun 2009 8:51 Modified: 15 Jun 2009 7:39
Reporter: Meiji KIMURA Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:5.1.31sp1, 5.0.34 OS:Linux (RHEL5, CentOS 5)
Assigned to: Georgi Kodinov CPU Architecture:Any

[2 Jun 2009 8:51] Meiji KIMURA
Description:
I have two innodb tables(apox. 200000-row and 100000-row).
When I joined two tables with specific value, MySQL server down.

I looked into settings. When I don't use 'innodb_file_per_table' for MySQL server, the same SQL works well. So 'innodb_file_per_table' cause this problem, I think.

How to repeat:
I can repeat this problem under the specific environment.
Please contact me about it.

Suggested fix:
[Workaround] 

Don't use 'innodb_file_per_table' for it.

[Suggested fix]

N/A.
[2 Jun 2009 9:53] MySQL Verification Team
Just wanted to add some further information in public view here. I repeated on 5.1.34-debug on windows, attached is the full stack trace with some more information.

mysqld-debug.exe!row_sel_field_store_in_mysql_format()[row0sel.c:2464]
mysqld-debug.exe!row_sel_store_mysql_rec()[row0sel.c:2672]
mysqld-debug.exe!row_search_for_mysql()[row0sel.c:4222]
mysqld-debug.exe!ha_innobase::index_read()[ha_innodb.cc:4410]
mysqld-debug.exe!ha_innobase::index_first()[ha_innodb.cc:4674]
mysqld-debug.exe!ha_innobase::rnd_next()[ha_innodb.cc:4771]
mysqld-debug.exe!rr_sequential()[records.cc:381]
mysqld-debug.exe!join_init_read_record()[sql_select.cc:11780]
mysqld-debug.exe!sub_select()[sql_select.cc:11108]
mysqld-debug.exe!do_select()[sql_select.cc:10865]
mysqld-debug.exe!JOIN::exec()[sql_select.cc:2199]
mysqld-debug.exe!mysql_select()[sql_select.cc:2380]
mysqld-debug.exe!handle_select()[sql_select.cc:268]
mysqld-debug.exe!execute_sqlcom_select()[sql_parse.cc:4982]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:2204]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5902]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1216]
mysqld-debug.exe!do_command()[sql_parse.cc:857]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1115]
mysqld-debug.exe!pthread_start()[my_winthread.c:85]
mysqld-debug.exe!_callthreadstart()[thread.c:293]
mysqld-debug.exe!_threadstart()[thread.c:277]

Crash:

for (;;) {
  ptr--;
  *ptr = *data;  <------- crash
  if (ptr == dest) {
    break;
  }
  data++;
}
[2 Jun 2009 9:55] MySQL Verification Team
full stack trace from 5.1.34 crash

Attachment: full_stack_trace_5.1.34.txt (text/plain), 3.27 KiB.

[2 Jun 2009 14:50] MySQL Verification Team
Meiji,

The testcase crashes no matter if you used innodb_file_per_table or not.
The real problem to concentrate on is sort_buffer_size variable.

Look - here is a simpler testcase:

drop table if exists t1;
create table t1(a varchar(128),b varchar(128),key(a),key(b))engine=innodb;
insert into t1 values (repeat('a',128),repeat('b',128));
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
set session sort_buffer_size=1;
select * from t1 force index(a,b) where a like 'a%' or b like 'b%' order by a,b;

It looks like this bug is actually a duplicate of bug #44810 !
[6 Jun 2009 21:29] Meiji KIMURA
Hi Shane,

Thank you for your test. I agree with you. This problem is caused by the same reason you mentioned.
[15 Jun 2009 7:39] Georgi Kodinov
Fixed by the same fix as bug #44810