Bug #52267 backup_logs test fails on 32 bits OpenSolaris
Submitted: 22 Mar 2010 8:21 Modified: 9 Jan 2015 16:02
Reporter: Olav Sandstå Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:6.0.14 OS:Solaris (OpenSolaris 32 bits, x86)
Assigned to: CPU Architecture:Any
Tags: pb2

[22 Mar 2010 8:21] Olav Sandstå
Description:
The test backup_logs fails when running 32 bit debug version of MySQL on OpenSolaris:

backup.backup_logs                       [ fail ]
        Test ended at 2010-03-22 09:15:13

CURRENT_TEST: backup.backup_logs
mysqltest: At line 606: query 'BACKUP DATABASE backup_logs to 'backup_logs_orig_intr.bak'' failed with wrong errno 2013: 'Lost connection to MySQL server during query', instead of 1317...

How to repeat:
1. Use the latest source from mysql-6.0-codebase-bugfixing

2. Compile debug binaries of MySQL for 32 bit archicture on a x86 server running OpenSolaris.

3. Run test:

     ./mtr --suite=backup backup_logs

Suggested fix:
Should not crash.
[22 Mar 2010 8:22] Olav Sandstå
Call stack from the core file:

  ---- called from signal handler with signal 11 (SIGSEGV) ------
  [8] strmov(dst = (nil), src = 0xfe07f4fa "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), line 36 in "strmov.c"
  [9] my_dir(path = 0x8e93044 ".", MyFlags = 1024), line 162 in "my_lib.c"
  [10] find_files(thd = 0xe2d5e48, files = 0xfe080010, db = (nil), path = 0x8e93044 ".", wild = (nil), dir = true), line 408 in "sql_show.cc"
  [11] make_db_list(thd = 0xe2d5e48, files = 0xfe080010, lookup_field_vals = 0xfe08002c, with_i_schema = 0xfe080023), line 2848 in "sql_show.cc"
  [12] get_all_tables(thd = 0xe2d5e48, tables = 0xe4f4b70, cond = 0xe4f51d0), line 3565 in "sql_show.cc"
  [13] get_schema_tables_result(join = 0xe42f760, executed_place = PROCESSED_BY_JOIN_EXEC), line 6800 in "sql_show.cc"
  [14] JOIN::exec(this = 0xe42f760), line 2497 in "sql_select.cc"
  [15] st_select_lex_unit::exec(this = 0xe4f3bdc), line 536 in "sql_union.cc"
  [16] mysql_union(thd = 0xe2d5e48, lex = 0xe4f3b80, result = 0xe4a77d0, unit = 0xe4f3bdc, setup_tables_done_option = 0), line 34 in "sql_union.cc"
  [17] handle_select(thd = 0xe2d5e48, lex = 0xe4f3b80, result = 0xe4a77d0, setup_tables_done_option = 0), line 282 in "sql_select.cc"
  [18] execute_sqlcom_select(thd = 0xe2d5e48, all_tables = 0xe4f4b70), line 5032 in "sql_parse.cc"
  [19] mysql_execute_command(thd = 0xe2d5e48), line 2295 in "sql_parse.cc"
  [20] Execute_sql_statement::execute_server_code(this = 0xfe082ec8, thd = 0xe2d5e48), line 2947 in "sql_prepare.cc"
  [21] Prepared_statement::execute_server_runnable(this = 0xfe082b98, server_runnable = 0xfe082ec8), line 3433 in "sql_prepare.cc"
  [22] Ed_connection::execute_direct(this = 0xfe082ff4, server_runnable = 0xfe082ec8), line 3947 in "sql_prepare.cc"
  [23] Ed_connection::execute_direct(this = 0xfe082ff4, sql_text = STRUCT), line 3913 in "sql_prepare.cc"
  [24] __unnamed_B_pdjMe3oLXHD::run_service_interface_sql(thd = 0xe2d5e48, ed_connection = 0xfe082ff4, query = 0xfe082fe4, get_warnings = true), line 242 in "si_objects.cc"
  [25] obs::get_num_objects(thd = 0xe2d5e48, db_name = 0xe533034), line 2662 in "si_objects.cc"
  [26] obs::check_user_access(thd = 0xe2d5e48, db_name = 0xe533034, has_access = 0xfe0832c3), line 2691 in "si_objects.cc"
  [27] Backup_info::add_db(this = 0xe47df10, obj = 0xe533000), line 768 in "backup_info.cc"
  [28] Backup_info::add_dbs(this = 0xe47df10, thd = 0xe2d5e48, dbs = CLASS), line 856 in "backup_info.cc"
  [29] execute_backup_command(thd = 0xe2d5e48, lex = 0xe2d6e10, backupdir = 0xfe084acc, overwrite = false, skip_gap_event = false), line 303 in "kernel.cc"
  [30] mysql_execute_command(thd = 0xe2d5e48), line 2614 in "sql_parse.cc"
  [31] mysql_parse(thd = 0xe2d5e48, inBuf = 0xe2e19f8 "BACKUP DATABASE backup_logs to 'backup_logs_orig_intr.bak'", length = 58U, found_semicolon = 0xfe085cec), line 6060 in "sql_parse.cc"
  [32] dispatch_command(command = COM_QUERY, thd = 0xe2d5e48, packet = 0xe2d9b49 "BACKUP DATABASE backup_logs to 'backup_logs_orig_intr.bak'", packet_length = 58U), line 1091 in "sql_parse.cc"  [33] do_command(thd = 0xe2d5e48), line 775 in "sql_parse.cc"
  [34] do_handle_one_connection(thd_arg = 0xe2d5e48), line 1173 in "sql_connect.cc"
  [35] handle_one_connection(arg = 0xe2d5e48), line 1113 in "sql_connect.cc"
  [36] pfs_spawn_thread(arg = 0xe225cc8), line 1011 in "pfs.cc"
  [37] _thrp_setup(0xfe935a00), at 0xfecccd56
  [38] _lwp_start(0xe, 0xb, 0x0, 0xfecca9ea, 0xfe07f17c, 0x8fb3f74), at 0xfecccfe0
[22 Mar 2010 18:44] Sveta Smirnova
Thank you for the report.

Set to "Verified" as it was documented in pushbuild, although is not repeatable in our environment.
[26 Mar 2010 10:15] Thava Alagu
There seems to be memory corruption during the call to readdir_r() when the directory contains a file of length 255. I could reproduce the problem on Olav (bug reporter's) machine with the reduced following test case:

 --source include/have_debug.inc

DROP DATABASE IF EXISTS test_db;

CREATE DATABASE test_db;

set @old_slow_query_log_file = @@global.slow_query_log_file;
set @@global.slow_query_log_file = repeat('a', 255);
set @@global.slow_query_log_file = default;

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES; 

#
# Cleanup.
#

DROP DATABASE test_db;
set @@global.slow_query_log_file = @old_slow_query_log_file;

The above query fails with similar stack trace.
[26 Mar 2010 10:41] Thava Alagu
Note that in the above test case, following statement should be executed first to enable slow query log (if not already enabled) :
  set @@global.slow_query_log = ON;
Then, the subsequent statement below creates a file of length 255 in data dir :
   set @@global.slow_query_log_file = repeat('a', 255);