22-1.trusty)

efzxgjgh  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(358)

mysql数据库(percona server for mysql 5.7.22-22-1.trusty)中存在死锁问题。每24小时我们的mysql就会停止响应。进程仍在运行,但无法创建新连接。在分析线程之后,我们看到锁中存在循环。你知道我们能做些什么来解决我们的问题吗?
环境

Linux version 3.13.0-151-generic (buildd@lgw01-amd64-034) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4) ) #201-Ubuntu SMP Wed May 30 14:22:13 UTC 2018
MemTotal: 528281684 kB
cpu: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz

jupyther (kvm, qemu)
MemTotal: 154745476 kB

gdb会话:

(gdb) thread 1634
[Switching to thread 1634 (Thread 0x7fe9bacdb700 (LWP 124547))]

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

135     ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
(gdb) bt

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

# 1  0x00007feb62d3767f in _L_lock_1081 () from /lib/x86_64-linux-gnu/libpthread.so.0

# 2  0x00007feb62d375f8 in __GI___pthread_mutex_lock (mutex=0x2cba198) at ../nptl/pthread_mutex_lock.c:134

# 3  0x000000000079d77d in Global_THD_manager::do_for_all_thd_copy(Do_THD_Impl*) ()

# 4  0x0000000000cedba0 in calc_sum_of_all_status(system_status_var*) ()

# 5  0x0000000000ca3fbc in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()

# 6  0x0000000000ca5097 in do_command(THD*) ()

# 7  0x0000000000d6a9d0 in handle_connection ()

# 8  0x0000000000ede1e4 in pfs_spawn_thread ()

# 9  0x00007feb62d35184 in start_thread (arg=0x7fe9bacdb700) at pthread_create.c:312

# 10 0x00007feb6224203d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) up 2

# 2  0x00007feb62d375f8 in __GI___pthread_mutex_lock (mutex=0x2cba198) at ../nptl/pthread_mutex_lock.c:134

134     ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb) print mutex.__data.__owner
$9 = 142327
(gdb) thread find 142327
Thread 1611 has target id 'Thread 0x7fe9bb762700 (LWP 142327)'
(gdb) thread 1611
[Switching to thread 1611 (Thread 0x7fe9bb762700 (LWP 142327))]

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

135     ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
(gdb) bt

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

# 1  0x00007feb62d3767f in _L_lock_1081 () from /lib/x86_64-linux-gnu/libpthread.so.0

# 2  0x00007feb62d375f8 in __GI___pthread_mutex_lock (mutex=0x7fe76142fbe8) at ../nptl/pthread_mutex_lock.c:134

# 3  0x0000000000cfecac in Fill_process_list::operator()(THD*) ()

# 4  0x000000000079d8dd in Global_THD_manager::do_for_all_thd_copy(Do_THD_Impl*) ()

# 5  0x0000000000ce61bc in fill_schema_processlist(THD*, TABLE_LIST*, Item*) ()

# 6  0x0000000000ce628c in ?? ()

# 7  0x0000000000cf914c in get_schema_tables_result(JOIN*, enum_schema_table_state) ()

# 8  0x0000000000cdc0ad in JOIN::prepare_result() ()

# 9  0x0000000000c6cce0 in JOIN::exec() ()

# 10 0x0000000000cdc9fd in handle_query(THD*, LEX*, Query_result*, unsigned long long, unsigned long long) ()

# 11 0x000000000075cf43 in ?? ()

# 12 0x0000000000c9f8f6 in mysql_execute_command(THD*, bool) ()

# 13 0x0000000000ca2afd in mysql_parse(THD*, Parser_state*) ()

# 14 0x0000000000ca36bd in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()

# 15 0x0000000000ca5097 in do_command(THD*) ()

# 16 0x0000000000d6a9d0 in handle_connection ()

# 17 0x0000000000ede1e4 in pfs_spawn_thread ()

# 18 0x00007feb62d35184 in start_thread (arg=0x7fe9bb762700) at pthread_create.c:312

# 19 0x00007feb6224203d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) up 2

# 2  0x00007feb62d375f8 in __GI___pthread_mutex_lock (mutex=0x7fe76142fbe8) at ../nptl/pthread_mutex_lock.c:134

134     ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb) print mutex.__data.__owner
$10 = 109111
(gdb) thread find 109111
Thread 1648 has target id 'Thread 0x7fe9bbb98700 (LWP 109111)'
(gdb) thread 1648
[Switching to thread 1648 (Thread 0x7fe9bbb98700 (LWP 109111))]

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

135     ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
(gdb) bt

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

# 1  0x00007feb62d37649 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0

# 2  0x00007feb62d37470 in __GI___pthread_mutex_lock (mutex=0x1d7ebe8 <mysql_bin_log+8>) at ../nptl/pthread_mutex_lock.c:79

# 3  0x0000000000d3021f in PolyLock_lock_log::rdlock() ()

# 4  0x0000000000c133b5 in sys_var::value_ptr(THD*, THD*, enum_var_type, st_mysql_lex_string*) ()

# 5  0x0000000000ceda2c in get_one_variable_ext(THD*, THD*, st_mysql_show_var const*, enum_var_type, enum_mysql_show_type, system_status_var*, charset_info_st const**, char*, unsigned long*) ()

# 6  0x0000000000f08869 in System_variable::init(THD*, st_mysql_show_var const*, enum_var_type) ()

# 7  0x0000000000f08e75 in PFS_system_variable_cache::do_materialize_all(THD*) ()

# 8  0x0000000000f34b0a in table_session_variables::rnd_init(bool) ()

# 9  0x0000000000edca2c in ha_perfschema::rnd_init(bool) ()

# 10 0x0000000000807722 in handler::ha_rnd_init(bool) ()

# 11 0x0000000000c04f34 in init_read_record(READ_RECORD*, THD*, TABLE*, QEP_TAB*, int, bool, bool) ()

# 12 0x0000000000c705be in join_init_read_record(QEP_TAB*) ()

# 13 0x0000000000c73f8b in sub_select(JOIN*, QEP_TAB*, bool) ()

# 14 0x0000000000c6ce97 in JOIN::exec() ()

# 15 0x0000000000c68c14 in TABLE_LIST::materialize_derived(THD*) ()

# 16 0x0000000000c6d8bf in join_materialize_derived(QEP_TAB*) ()

# 17 0x0000000000c6d3b2 in QEP_TAB::prepare_scan() ()

# 18 0x0000000000c73eb0 in sub_select(JOIN*, QEP_TAB*, bool) ()

# 19 0x0000000000c6ce97 in JOIN::exec() ()

# 20 0x0000000000cdc9fd in handle_query(THD*, LEX*, Query_result*, unsigned long long, unsigned long long) ()

# 21 0x000000000075cf43 in ?? ()

# 22 0x0000000000c9f8f6 in mysql_execute_command(THD*, bool) ()

# 23 0x0000000000ca2afd in mysql_parse(THD*, Parser_state*) ()

# 24 0x0000000000ca36bd in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()

# 25 0x0000000000ca5097 in do_command(THD*) ()

# 26 0x0000000000d6a9d0 in handle_connection ()

# 27 0x0000000000ede1e4 in pfs_spawn_thread ()

# 28 0x00007feb62d35184 in start_thread (arg=0x7fe9bbb98700) at pthread_create.c:312

# 29 0x00007feb6224203d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) up 2

# 2  0x00007feb62d37470 in __GI___pthread_mutex_lock (mutex=0x1d7ebe8 <mysql_bin_log+8>) at ../nptl/pthread_mutex_lock.c:79

79      ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb) print mutex.__data.__owner
$11 = 63889
(gdb) thread find 63889
Thread 1808 has target id 'Thread 0x7fea780f5700 (LWP 63889)'
(gdb) thread 1808
[Switching to thread 1808 (Thread 0x7fea780f5700 (LWP 63889))]

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

135     ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
(gdb) bt

# 0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135

# 1  0x00007feb62d3767f in _L_lock_1081 () from /lib/x86_64-linux-gnu/libpthread.so.0

# 2  0x00007feb62d375f8 in __GI___pthread_mutex_lock (mutex=0x1d37c80 <LOCK_status>) at ../nptl/pthread_mutex_lock.c:134

# 3  0x0000000000e5b098 in MYSQL_BIN_LOG::publish_coordinates_for_global_status() const ()

# 4  0x0000000000e6147e in MYSQL_BIN_LOG::ordered_commit(THD*, bool, bool) ()

# 5  0x0000000000e64902 in MYSQL_BIN_LOG::commit(THD*, bool) ()

# 6  0x00000000008005e1 in ha_commit_trans(THD*, bool, bool) ()

# 7  0x0000000000d4b7be in trans_commit_stmt(THD*) ()

# 8  0x0000000000c9b6ea in mysql_execute_command(THD*, bool) ()

# 9  0x0000000000ca2afd in mysql_parse(THD*, Parser_state*) ()

# 10 0x0000000000ca36bd in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()

# 11 0x0000000000ca5097 in do_command(THD*) ()

# 12 0x0000000000d6a9d0 in handle_connection ()

# 13 0x0000000000ede1e4 in pfs_spawn_thread ()

# 14 0x00007feb62d35184 in start_thread (arg=0x7fea780f5700) at pthread_create.c:312

# 15 0x00007feb6224203d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) up 2

# 2  0x00007feb62d375f8 in __GI___pthread_mutex_lock (mutex=0x1d37c80 <LOCK_status>) at ../nptl/pthread_mutex_lock.c:134

134     ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb)  print mutex.__data.__owner
$12 = 124547
(gdb) thread find 124547
Thread 1634 has target id 'Thread 0x7fe9bacdb700 (LWP 124547)'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题