Overview
Features
Download
Documentation
Community
Add-Ons & Services

MySQL sessions and threads

Please post support and help requests here.

MySQL sessions and threads

Postby gregee123 » 06 May 2013, 20:30

I use a few threads, each of them is supposed to have its own MySQL connection. I call Connector::registerConnector in the main thread and then create a session in each thread (to be precise new Session is called from a different pthread). Registering the connector as well as creating sessions inits new threads with mysql (my_thread_init()), so with say 4 worker threads I have 5 calls to my_thread_init(). Threads close their sessions themselves as they finish their jobs but calling Session.close doesn't seem to invoke my_thread_end() so when I finally call Connector::Unregister I get an error: my_thread_global_end(): 4 threads didn't exit.

How should I properly close the sessions so that the treads are ended in libmysqlclient ? mysql_close() called from SessionHandle doesn't seem to end the thread from mysql point of view and that leads to memory leaks.
currently using: 1.5.4
gregee123
 
Posts: 55
Joined: 29 Mar 2013, 12:11

Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron