From 2d85f0603968093d00a035a39963454c8af9b16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sat, 30 Dec 2017 15:35:37 +0100 Subject: [PATCH] Fix bug #1307 . Add lock when adding PS to cache --- lib/MySQL_Session.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 5b08da8d2..44b0e0226 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -2639,6 +2639,7 @@ handler_again: case PROCESSING_STMT_PREPARE: { thread->status_variables.backend_stmt_prepare++; + GloMyStmt->wrlock(); #ifndef PROXYSQL_STMT_V14 uint32_t stmid; #else @@ -2668,7 +2669,7 @@ handler_again: qpo->cache_ttl, qpo->timeout, qpo->delay, - true); + false); #endif if (CurrentQuery.QueryParserArgs.digest_text) { if (stmt_info->digest_text==NULL) { @@ -2686,6 +2687,7 @@ handler_again: if (previous_status.size() == 0) client_stmtid=client_myds->myconn->local_stmts->generate_new_client_stmt_id(global_stmtid); #endif + GloMyStmt->wrlock(); CurrentQuery.mysql_stmt=NULL; enum session_status st=status; size_t sts=previous_status.size();