0

这是我的程序崩溃的堆栈跟踪

Program terminated with signal 11, Segmentation fault.
#0  0x00002ae1caf18008 in safer_scalable_free ()
   from /home/is_admin/tbb40_233oss/build/linux_intel64_gcc_cc4.1.2_libc2.5_kernel2.6.18_release/libtbbmalloc.so.2
(gdb) bt
#0  0x00002ae1caf18008 in safer_scalable_free ()
   from /home/is_admin/tbb40_233oss/build/linux_intel64_gcc_cc4.1.2_libc2.5_kernel2.6.18_release/libtbbmalloc.so.2
#1  0x00002ae1cad12189 in free ()
   from /home/is_admin/tbb40_233oss/build/linux_intel64_gcc_cc4.1.2_libc2.5_kernel2.6.18_release/libtbbmalloc_proxy.so.2
#2  0x00002ae1cb56fb60 in mysql_close_free (mysql=0x2ae1cc491600)
    at /home/is_admin/MRPlatform/src/mysql-5.5.17/sql-common/client.c:3643
#3  0x00002ae1cb570ef1 in mysql_close (mysql=0x2ae1cc491600) at /home/is_admin/MRPlatform/src/mysql-5.5.17/sql-common/client.c:3744
#4  0x00002ae1cb573ad4 in mysql_reconnect (mysql=0x2ae1cc491600)
    at /home/is_admin/MRPlatform/src/mysql-5.5.17/sql-common/client.c:3561
#5  0x00002ae1cb573c37 in cli_advanced_command (mysql=0x2ae1cc491600, command=<value optimized out>, header=0x0, header_length=0, 
    arg=0x0, arg_length=0, skip_check=0 '\000', stmt=0x0) at /home/is_admin/MRPlatform/src/mysql-5.5.17/sql-common/client.c:852
#6  0x00002ae1cb56a3e1 in mysql_ping (mysql=0x1) at /home/is_admin/MRPlatform/src/mysql-5.5.17/libmysql/libmysql.c:969
#7  0x000000000042ded6 in TDRNetwork::DataAccess::ExecuteSQL(char const*) ()
#8  0x000000000041c511 in MRSystem::Master::Process(TDRNetwork::JobMsg*) ()
#9  0x000000000042a33f in MRSystem::MasterWorker::Run() ()
#10 0x000000000042fc99 in TDRNetwork::Thread::StartThread(void*) ()
#11 0x00000033b080673d in start_thread () from /lib64/libpthread.so.0
#12 0x00000033b00d44bd in clone () from /lib64/libc.so.6

在第 6 帧,我注意到 mysql=0x1 越界。如果不采取任何措施,似乎 mysql 链接会在 8 小时后自动关闭。那么为什么重新连接失败呢?谢谢。

编辑:

错误发生在 client.c:3643 my_free(mysql->info_buffer);

#if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100
  my_free(mysql->info_buffer);
  mysql->info_buffer= 0;
#endif

并且 info_buffer 超出范围:

(gdb) p *mysql
$2 = {net = {vio = 0x0, buff = 0x0, buff_end = 0x2aaaabcf5080 "", write_pos = 0x2aaaabcf3080 "", read_pos = 0x2aaaabcf3080 "", 
    fd = 10, remain_in_buf = 0, length = 0, buf_length = 0, where_b = 0, max_packet = 8192, max_packet_size = 1073741824, 
    pkt_nr = 1, compress_pkt_nr = 0, write_timeout = 31536000, read_timeout = 31536000, retry_count = 1, fcntl = 0, 
    return_status = 0x0, reading_or_writing = 0 '\000', save_char = 0 '\000', unused1 = 0 '\000', unused2 = 0 '\000', 
    compress = 0 '\000', unused3 = 0 '\000', unused = 0x0, last_errno = 0, error = 2 '\002', unused4 = 0 '\000', 
    unused5 = 0 '\000', last_error = '\000' <repeats 511 times>, sqlstate = "00000", extension = 0x0}, connector_fd = 0x0, 
  host = 0x2aaaabea34b8 "127.0.0.1", user = 0x2aaaabeb3bf8 "", passwd = 0x2aaaabeb3c00 "\370;뫪*", unix_socket = 0x0, 
  server_version = 0x2aaaabea34d0 "5.5.17", host_info = 0x2aaaabea34a0 "", info = 0x0, db = 0x2aaaabeb3c08 "", 
  charset = 0x2aaaab661060, fields = 0x0, field_alloc = {free = 0x0, used = 0x0, pre_alloc = 0x0, min_malloc = 32, 
    block_size = 8160, block_num = 4, first_block_usage = 0, error_handler = 0}, affected_rows = 18446744073709551615, 
  insert_id = 0, extra_info = 0, thread_id = 472, packet_length = 7, port = 3306, client_flag = 959117, 
  server_capabilities = 18446744071563114495, protocol_version = 10, field_count = 0, server_status = 2, server_language = 33, 
  warning_count = 0, options = {connect_timeout = 0, read_timeout = 0, write_timeout = 0, port = 0, protocol = 0, client_flag = 0, 
    host = 0x0, user = 0x0, password = 0x0, unix_socket = 0x0, db = 0x0, init_commands = 0x0, my_cnf_file = 0x0, 
    my_cnf_group = 0x0, charset_dir = 0x0, charset_name = 0x0, ssl_key = 0x0, ssl_cert = 0x0, ssl_ca = 0x0, ssl_capath = 0x0, 
    ssl_cipher = 0x0, shared_memory_base_name = 0x0, max_allowed_packet = 0, use_ssl = 0 '\000', compress = 0 '\000', 
    named_pipe = 0 '\000', unused1 = 0 '\000', unused2 = 0 '\000', unused3 = 0 '\000', unused4 = 0 '\000', 
    methods_to_use = MYSQL_OPT_CONNECT_TIMEOUT, client_ip = 0x0, secure_auth = 0 '\000', report_data_truncation = 0 '\000', 
    local_infile_init = 0, local_infile_read = 0, local_infile_end = 0, local_infile_error = 0, local_infile_userdata = 0x0, 
    extension = 0x0}, status = MYSQL_STATUS_READY, free_me = 0 '\000', reconnect = 1 '\001', scramble = "[k)(,EVacN<#96B(?E{_", 
  unused1 = 0 '\000', unused2 = 0x0, unused3 = 0x0, unused4 = 0x0, unused5 = 0x0, stmts = 0x0, methods = 0x2aaaab650100, 
  thd = 0x0, unbuffered_fetch_owner = 0x0, **info_buffer = 0x1 <Address 0x1 out of bounds>**, extension = 0x2aaaabebb708}
4

0 回答 0