From 81faa98f21234466ed0faf5fb919c9345cb2f935 Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 14 Jul 2020 21:03:25 +0200 Subject: [PATCH] add mutex for connection manager, maybe there is where the mysql error are coming from, if two threads call getConnection at the same time --- src/cpp/SingletonManager/ConnectionManager.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cpp/SingletonManager/ConnectionManager.h b/src/cpp/SingletonManager/ConnectionManager.h index 9f7057d5c..90ad7cd93 100644 --- a/src/cpp/SingletonManager/ConnectionManager.h +++ b/src/cpp/SingletonManager/ConnectionManager.h @@ -36,6 +36,8 @@ public: } inline Poco::Data::Session getConnection(ConnectionType type) { + Poco::ScopedLock _lock(mWorkingMutex); + switch (type) { case CONNECTION_MYSQL_LOGIN_SERVER: @@ -55,6 +57,7 @@ protected: private: std::string mSessionPoolNames[CONNECTION_MAX]; Poco::Data::SessionPoolContainer mSessionPools; + Poco::FastMutex mWorkingMutex; }; #endif //GRADIDO_LOGIN_SERVER_SINGLETON_MANAGER_CONNECTION_MANAGER_INCLUDE \ No newline at end of file