[Cppcms-users] Connection errors while using connection pool in multithreading programms (beside cp
Brought to you by:
artyom-beilis
From: Alexander M. <a....@ev...> - 2015-07-16 10:01:47
|
Hello Artyom, Hello Community, I'm testing cppdb as db-interface for a "non-cppcms" program. At the start of the program, I'm creating a global cppdb pool using the following command: // Create the pool cppdb::pool::pointer <http://cppcms.com/sql/cppdb/classcppdb_1_1ref__ptr.html> my_pool =cppdb::pool::create <http://cppcms.com/sql/cppdb/classcppdb_1_1pool.html#a5f0d996be0a4da7750edb2c00d3f6a78>("sqlite3:db=test.db"); After that, I'm starting some threads. Each thread is trying to create a cppdb::session using the following command and doing some commands on the db: // Use the pool cppdb::session <http://cppcms.com/sql/cppdb/classcppdb_1_1session.html> sql(my_pool->open <http://cppcms.com/sql/cppdb/classcppdb_1_1pool.html#aae9914b4323d982c49c4604b0696ecb0>()); sql.once(...); // doing some config sql << ... // using session / doing some stuff on db.. If I'm "deactivating" the multithreading it works fine (I'm join()ing the threads directly after creating them). As soon as I'm trying to run more than one thread at the same time, only the first thread works fine.. Each following thread throws a "cppdb::mysql::Can't connect to MySQL server on 'localhost' (111)" exceptions. I already checked my mysql settings (e.g. max connections) and they are set on 500. Has someone of you tried to do the same and got the same issues? I'm happy about every hint :-) Thank you very much, Alex |