Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems occur when parsing sql_mode #1904

Closed
5 tasks done
cahlchang opened this issue Feb 15, 2019 · 3 comments
Closed
5 tasks done

Problems occur when parsing sql_mode #1904

cahlchang opened this issue Feb 15, 2019 · 3 comments

Comments

@cahlchang
Copy link

I found the failure in the parser with following SQL.

issue

SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO');

This SQL statement is often used in combination of RoR 5 and MySQL 5.
In the current parser, I assumed only one CONCAT function, it seemed that the interpretation of the regular expression was wrong.
see
https://github.com/sysown/proxysql/blob/v2.0.2/lib/set_parser.cpp#L38
The following error sentence can be seen.

2019-02-14 10:47:29 MySQL_Session.cpp:1610:handler_again___status_SETTING_SQL_MODE(): [WARNING] Error while setting SQL_MODE: 1231, Variable 'sql_mode' can't be set to the value of 'CONCAT'

I resolved this problem. I’ll send a PR, review it please.

  • A clear description of your issue

version

# ~/proxysql.org --version
ProxySQL version 2.0.1-4-gac2e710, codename Truls
CentOS Linux 7.4
  • The version of OS and ProxySQL

Reproduction

A driver that pools connection such as RoR 5, when nesting two or more CONCAT functions.

  • Every step to reproduce the issue

error log

Repeat it.

2019-02-14 10:47:29 MySQL_Session.cpp:1610:handler_again___status_SETTING_SQL_MODE(): [WARNING] Error while setting SQL_MODE: 1231, Variable 'sql_mode' can't be set to the value of 'CONCAT'
  • The error log

core dump

Although accurate reproduction has not been obtained, the next core dump was found.

(gdb) backtrace
#0  0x00000000004e2de7 in MySQL_Protocol::process_pkt_handshake_response (this=0x7f17d70a1ea0, pkt=0x7f17d85fa132 "caching_sha2_password", len=<optimized out>) at MySQL_Protocol.cpp:1510
#1  0x00000000004ce13b in MySQL_Session::handler___status_CONNECTING_CLIENT___STATE_SERVER_HANDSHAKE (this=0x7f17d70c8200, pkt=0x7f17d7bfd840, wrong_pass=0x7f17d7bfd82f)
    at MySQL_Session.cpp:3526
#2  0x00000000004db31e in MySQL_Session::handler (this=this@entry=0x7f17d70c8200) at MySQL_Session.cpp:2177
#3  0x00000000004bfc9c in MySQL_Thread::process_all_sessions (this=this@entry=0x7f17d709dc00) at MySQL_Thread.cpp:3578
#4  0x00000000004ca1e6 in MySQL_Thread::run (this=this@entry=0x7f17d709dc00) at MySQL_Thread.cpp:3337
#5  0x000000000048b8fc in mysql_worker_thread_func (arg=0x7f17d98d7430) at main.cpp:627
#6  0x00007f17dafdae25 in start_thread () from /lib64/libpthread.so.0
#7  0x00007f17d9ec634d in clone () from /lib64/libc.so.6
  • If it is a crashing bug, please check here:
@cahlchang cahlchang changed the title Fixed sql_mode parser issue Problems occur when parsing sql_mode Feb 15, 2019
@gondaz
Copy link

gondaz commented Mar 7, 2019

Confirm the aforementioned behavior. Hope, it will be fixed in the upcoming update.

@renecannao
Copy link
Contributor

Fixed in ProxySQL 2.0.4.
Thank you very much for the report.

@cahlchang
Copy link
Author

Thanks to improve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants