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

Proxysql crash #1307

Closed
KlausOvergaard opened this issue Dec 28, 2017 · 6 comments
Closed

Proxysql crash #1307

KlausOvergaard opened this issue Dec 28, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@KlausOvergaard
Copy link

We upgraded from 1.4.3 to 1.4.4, but this caused proxysql to crash every 5 min or so with this in the logs:

Error: signal 11:
proxysql(_Z13crash_handleri+0x1a)[0x44baba]
/lib64/libc.so.6(+0x35270)[0x7fb301c7b270]
proxysql(_ZN22MySQL_STMT_Manager_v1416ref_count_clientEmib+0x227)[0x4c53f7]
proxysql(_ZN21MySQL_STMTs_local_v1427generate_new_client_stmt_idEm+0x166)[0x4c5776]
proxysql(_ZN13MySQL_Session7handlerEv+0x25de)[0x488f5e]
proxysql(_ZN12MySQL_Thread20process_all_sessionsEv+0x29c)[0x47030c]
proxysql(_ZN12MySQL_Thread3runEv+0xd66)[0x478f06]
proxysql(_Z24mysql_worker_thread_funcPv+0x6c)[0x449afc]
/lib64/libpthread.so.0(+0x7e25)[0x7fb303525e25]
/lib64/libc.so.6(clone+0x6d)[0x7fb301d3e34d]
2017-12-27 08:08:01 main.cpp:913:ProxySQL_daemonize_phase3(): [ERROR] ProxySQL crashed. Restarting!
2017-12-27 08:08:01 [INFO] Angel process started ProxySQL process 23839
Standard ProxySQL Cluster rev. 0.1.0702 -- ProxySQL_Cluster.cpp -- Wed Dec 20 12:28:37 2017
Standard ProxySQL Statistics rev. 1.4.1027 -- ProxySQL_Statistics.cpp -- Wed Dec 20 12:28:37 2017
Standard ProxySQL HTTP Server Handler rev. 1.4.1031 -- ProxySQL_HTTP_Server.cpp -- Wed Dec 20 12:28:37 2017
Standard ProxySQL Admin rev. 0.2.0902 -- ProxySQL_Admin.cpp -- Wed Dec 20 12:28:37 2017
Standard MySQL Threads Handler rev. 0.2.0902 -- MySQL_Thread.cpp -- Wed Dec 20 12:28:37 2017
Standard MySQL Authentication rev. 0.2.0902 -- MySQL_Authentication.cpp -- Wed Dec 20 12:28:37 2017

We have therefore downgraded to 1.4.3 again.

@renecannao
Copy link
Contributor

Do you have a core dump?

@KlausOvergaard
Copy link
Author

Do you have a mail that I can sent a core dump download link to?

@renecannao
Copy link
Contributor

rene.cannao at gmail

Thanks

@renecannao
Copy link
Contributor

Hi Klaus,

Thank you again for providing the core dump, really useful: I think I found the bug!
I will create a unit test to make sure I can easily reproduce the bug, and that the fix really works.
It will probably take me 2 more days.

The bug is indeed a proxysql bug, but it seems triggered by some application misused of prepared statements.

Quoting wikipedia:

In database management systems, a prepared statement or parameterized statement is a feature used to execute the same or similar database statements repeatedly with high efficiency. Typically used with SQL statements such as queries or updates, the prepared statement takes the form of a template into which certain constant values are substituted during each execution.

In your case, it seems your application isn't using prepared statements as "templates", but all the parameters are part of the prepare. That also mean that the number of parameters is zero.
This leads to th fact that for ProxySQL every prepared statement is an unique prepared statement.
That is what triggered issue #1198 .
Issue #1198 was indeed fixed in 1.4.4 , but at high concurrency it leads to crash: #1307

Quoting again wikipedia:

On the other hand, if a query is executed only once, server-side prepared statements can be slower because of the additional round-trip to the server.

Please keep in mind that your application use of prepared statements is introducing some performance penalty: unless you use prepared statements as "templates" , I would recommend to not use them.

@KlausOvergaard
Copy link
Author

KlausOvergaard commented Dec 30, 2017 via email

@renecannao
Copy link
Contributor

Thanks for the details.
The 10% not using parameters are creating a lot of pressure and inefficiency in prepared statements metadata cache. In fact, it is possible that nearly all the prepared statements metadata cached are of ps without parameters.
I will evaluate if it makes sense for ProxySQL to either automatically tune down the size of metadata cache, and/or try to aggressively purge prepared statements without parameters

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

No branches or pull requests

2 participants