Open jd-zhang opened 2 years ago
mysql_raw里面的 host, socket_file, charset_三个成员,都是类成员,这种成员在内存被calloc清0后,貌似依赖于具体编译器的处理,在cygwin和ubuntu下,我看挺正常的,能显示出这种
$1 # {str1{static npos = <optimized out>, _M_dataplus # {<std::allocator<char>>{<__gnu_cxx::new_allocator<char>> # {<No data fields>}, <No data fields>}, _M_p0x0}, _M_string_length # 0, {_M_local_buf'\000' <repeats 15 times>, _M_allocated_capacity # 0}}, str2{static npos = <optimized out>, _M_dataplus # { <std::allocator<char>>{<__gnu_cxx::new_allocator<char>> # {<No data fields>}, <No data fields>}, _M_p0x0}, _M_string_length # 0, {_M_local_buf'\000' <repeats 15 times>, _M_allocated_capacity = 0}} }
放到编译用的centos7机器下,编译后以后显示的内容就是内存不可访问, 类似
$1 # { str1<error reading variable: Cannot access memory at address 0xffffffffffffffe8>, str2 = <error reading variable: Cannot access memory at address 0xffffffffffffffe8> }
more gdb info:
(gdb) p mysql_raw_ $1 = (kunlun_rbr::StatMysql *) 0x7f77f40044d0 (gdb) p *mysql_raw_ $2 # {status_kunlun_rbr::A_UNINITIALIZE, mysql_ # 0x7f77f4004670, result_0x0, ret_ # 0x0, err_0, row_ # 0x0, host_<error reading variable: Cannot access memory at address 0xffffffffffffffe8>, mysql_manager_ # 0x0, mysql_ares_0x7f77f4004580, pending_sql_ # {count0, start # 0x0, end0x0}, list_lock_ # {_vptr.AtomicLock0x0, flag_ # {<std::__atomic_flag_base>{ _M_i # false}, <No data fields>}}, mysql_timeout_3, mysql_rd_timeout_ # 3, mysql_wr_timeout_3, connect_type_ = kunlun::TCP_CONNECTION, socket_file_ = <error reading variable: Cannot access memory at address 0xffffffffffffffe8>, charset_ = <error reading variable: Cannot access memory at address 0xffffffffffffffe8>, user_ # 0x7f77f4004630 "clustmgr", passwd_0x7f77f4004650 "clustmgr_pwd", reconnect_ # 0, mysql_fd_0}
Issue migrated from trac ticket # 793
component: cluster manager | priority: major
2022-06-02 13:44:14: zhangjindong@zettadb.com created the issue