Bug #57895 assertion fd != -1 when open_files_limit is reached and csv tables can't open
Submitted: 1 Nov 2010 13:40 Modified: 8 Jun 2012 20:51
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: CSV Severity:S1 (Critical)
Version:5.1.53-debug OS:Any
Assigned to: CPU Architecture:Any

[1 Nov 2010 13:40] Shane Bester
Description:
during tests with low open_files_limit, debug server crashes on any attempt to open csv tables.  this is triggered when selecting from information_schema tables and slow_log or general_log is trying to be opened.

5.1.53 cut gdb output:

#4  in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  in abort () at abort.c:92
#6  in __assert_fail (assertion=0xbc48c4 "fd != -1", file=<value optimized out>, line=58, function=<value optimized out>) at assert.c:81
#7  in my_seek (fd=-1, pos=0, whence=0, MyFlags=0) at my_seek.c:58
#8  in write_meta_file (meta_file=-1, rows=0, dirty=true) at ha_tina.cc:307
#9  in free_share at ha_tina.cc:369
#10 in ha_tina::open  at ha_tina.cc:829
#11 in handler::ha_open  at handler.cc:2094
#12 in open_table_from_share at table.cc:1907
#13 in open_unireg_entry  at sql_base.cc:3932
#14 in open_table at sql_base.cc:2931
#15 in open_tables at sql_base.cc:4619
#16 in open_normal_and_derived_tables at sql_base.cc:5086
#17 in get_all_tables at sql_show.cc:3491
#18 in get_schema_tables_result at sql_show.cc:6174
#19 in JOIN::exec at sql_select.cc:1857
#20 in mysql_select at sql_select.cc:2544
#21 in handle_select at sql_select.cc:269
#22 in execute_sqlcom_select at sql_parse.cc:5144
#23 in mysql_execute_command at sql_parse.cc:2293
#24 in mysql_parse  at sql_parse.cc:6068
#25 in dispatch_command at sql_parse.cc:1261
#26 in do_command 
#27 in handle_one_connection 
#28 in start_thread

How to repeat:
debug build, have a low number of open_files_limit
and run any sql that consumes all file descriptors, so that error 24 is seen.
then "select * from information_schema.tables" should crash.
[1 Nov 2010 13:43] MySQL Verification Team
some details....

Attachment: bug57895_5.1.53_gdb_output.txt (text/plain), 29.62 KiB.

[9 Nov 2010 23:58] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior with union of MyISAM tables. You specified category as CSV while query INFORMATION SCHEMA. Does how to repeat affect CSV tables?
[10 Nov 2010 1:34] MySQL Verification Team
sveta, create at least one CSV table in a database. or enable general/slow logging to table which uses csv.  then sure you're out of file descriptors and try open these csv tables.  easiest way it hitting information_schema.

nothing to do with myisam or unions.
[8 May 2012 20:51] Sveta Smirnova
Shane,

I used following test case to repeat the problem:

set global log_output='table';
set global general_log=0;
set global general_log=1;

--disable_result_log
--disable_query_log
--error 23
select * from mysql.general_log g1 join  mysql.general_log g2 join  mysql.general_log g3
join mysql.general_log g4
join mysql.general_log g5
join mysql.general_log g6
;

--enable_query_log
select * from information_schema.tables;
--enable_result_log

select now();

And could not repeat crash: I got error "mysqltest: At line 22: query 'select * from information_schema.tables' failed: 1018: Can't read dir of '.' (errno: 24)" instead. Is bug still repeatable for you?
[9 Jun 2012 1: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".