mariadb make_query卡在make_query()调用中

时间:2018-12-03 10:08:58

标签: c++ mysql c mariadb

mariadb版本:10.2.12-6。
当我的远程mariadb重新评估(或类似操作)时,数据库查询永远停留在读取状态。 GDB堆栈跟踪确认读取卡住了:

#0  0x00007fe14b46d7ad in read () from /lib64/libpthread.so.0
#1  0x00007fe14d922935 in sock_read () from /lib64/libcrypto.so.10
#2  0x00007fe14d92099b in BIO_read () from /lib64/libcrypto.so.10
#3  0x00007fe14dc99fe4 in ssl3_read_n () from /lib64/libssl.so.10
#4  0x00007fe14dc9b87d in ssl3_read_bytes () from /lib64/libssl.so.10
#5  0x00007fe14dc98304 in ssl3_read_internal () from /lib64/libssl.so.10
#6  0x00007fe14e11eb6d in ma_tls_read () from /lib64/libmysqlclient.so.18
#7  0x00007fe14e10dd91 in ma_pvio_read () from /lib64/libmysqlclient.so.18
#8  0x00007fe14e10dff3 in ma_pvio_cache_read () from /lib64/libmysqlclient.so.18
#9  0x00007fe14e1041be in ma_real_read () from /lib64/libmysqlclient.so.18
#10 0x00007fe14e104fdc in ma_net_read () from /lib64/libmysqlclient.so.18
#11 0x00007fe14e109d5e in ma_net_safe_read () from /lib64/libmysqlclient.so.18
#12 0x00007fe14e10cfe5 in mthd_my_read_query_result () from /lib64/libmysqlclient.so.18
#13 0x00007fe14e563987 in make_query (
    query=0x7fe128ff8500 "update heartbeat set .........") at *****:2600
#14 0x000000000041691d in *******(short, unsigned char*) ()
#15 0x0000000000415761 in *******(void*) ()
#16 0x00007fe14b466dd5 in start_thread () from /lib64/libpthread.so.0
#17 0x00007fe14b190b3d in clone () from /lib64/libc.so.6

我试图找到是否有任何方法可以在对mysql / mariadb的make_query()调用中放置超时,但找不到任何方法。 任何人都知道如何为超时配置make_query()吗?

注意:使用的编程语言是C,C ++

2 个答案:

答案 0 :(得分:0)

您可以从新的子线程中调用此方法,并让父线程在其上等待直到超时,否则,如果它没有及时返回,则父线程可以杀死它。这不是一种干净的方法,但是可以解决您的问题。实际上,您可以抽象化此机制,以便将来对mariadb进行更新时,只需删除辅助子线程即可。

答案 1 :(得分:0)

在MariaDB中,请参见private MouseHandler mouseHandler; class MouseHandler { /* lists needed for enter/exit events generation */ private final List<EventTarget> pdrEventTargets = new ArrayList<EventTarget>(); private final List<EventTarget> currentEventTargets = new ArrayList<EventTarget>(); private final List<EventTarget> newEventTargets = new ArrayList<EventTarget>(); private final List<EventTarget> fullPDRCurrentEventTargets = new ArrayList<EventTarget>(); private final List<EventTarget> fullPDRNewEventTargets = new ArrayList<EventTarget>(); private EventTarget fullPDRCurrentTarget = null; } 和其他技术here

(提到的许多事情在MySQL中不可用。)