Open btimby opened 5 years ago
I have the same issue with 2.0.7, after applying the next rule: "INSERT INTO mysql_query_rules (rule_id,active,match_pattern,destination_hostgroup,mirror_hostgroup,apply) VALUES (1,1,'^SELECT',1,1,1);"
Error: signal 11: /usr/bin/proxysql(_Z13crash_handleri+0x1d)[0x5578b8004f9d] /lib/x86_64-linux-gnu/libc.so.6(+0x37840)[0x7f882ba6f840] /usr/bin/proxysql(_ZN15MySQL_ResultSet4initEP14MySQL_ProtocolP12st_mysql_resP8st_mysqlP13st_mysql_stmt+0x11)[0x5578b806ecb1] /usr/bin/proxysql(_ZN16MySQL_Connection7handlerEs+0x10b1)[0x5578b815cfd1] /usr/bin/proxysql(_ZN16MySQL_Connection11async_queryEsPcmPP13st_mysql_stmtP23stmt_execute_metadata_t+0x94)[0x5578b815d2b4] /usr/bin/proxysql(_ZN13MySQL_Session7handlerEv+0x233f)[0x5578b806232f] /usr/bin/proxysql(_ZN12MySQL_Thread20process_all_sessionsEv+0x26a)[0x5578b803f14a] /usr/bin/proxysql(_ZN12MySQL_Thread3runEv+0xa08)[0x5578b8048168] /usr/bin/proxysql(_Z24mysql_worker_thread_funcPv+0x6c)[0x5578b8001a5c] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7fa3)[0x7f882c150fa3] /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f882bb314cf] 2019-10-09 15:22:40 main.cpp:1395:ProxySQL_daemonize_phase3(): [ERROR] ProxySQL crashed. Restarting!
Hello,
I am testing mirroring with ProxySQL v2.0.6. I installed using the CentOS 7 rpm available from github.
https://github.com/sysown/proxysql/releases/download/v2.0.6/proxysql-2.0.6-1-centos7.x86_64.rpm
To reproduce, enable mirroring for a query rule. When you execute that query, proxysql immediately crashes with signal 11. Mirroring seems to be completely broken since this addition:
https://github.com/sysown/proxysql/commit/f3e7f039980f781b1cd87e07e1ad6e2ba104fe8e#diff-81ac570c4e1288d33fc5c4f49508a300R2222
In case of mirroring,
_myprot == NULL
, accessing_myprot->myds
results in a segmentation fault.Moving the declaration
MySQL_Data_Stream * c_myds = *(myprot->myds)
after the if statement on lines 2250-2252 would resolve this.This change fixes the segfault problem. Unfortunately, mirroring then exceeds max_connections for the
mirror_hostgroup
. I think connections for the mirrored queries are not being closed.