Hello , (answers below) El Viernes, 29 de Enero de 2010 21:24, Vivien Malerba escribió: > On 29 January 2010 20:08, Alberto Roman Linacero <aroman alienvault com> wrote: > > Now, I have another issue; it seems like suddenly, after some correct > > reads and writes, GDA locks, and I'm not sure when GDA doesn't release a > > lock, so that's my question. I have multiple threads reading and > > inserting data into the DB, some of them sharing the same GdaConnection, > > and others with its own one. And suddenly, they stop working. Each thread > > is built around a wrapper and a mutex, to avoid two threads accessing at > > the same time to DB: > > > > g_static_rec_mutex_lock (database->_priv->mutex); > > > > It would be a bit difficult to paste all the code because it's in > > multiple files, so I think that I'll have to guess what's happening just > > by knowing when GDA locks and doesn't release a lock. Could you please > > give some light on this? > > > > I've tried with the simple command...: > > ret = gda_execute_non_select_command (database->_priv->conn, buffer, > > &error__); > > > > ...and with the complex one, doing it myself: > > database->_priv->parser = gda_sql_parser_new (); > > stmt = gda_sql_parser_parse_string (database->_priv->parser, buffer, > > &remain, &error__); > > ret = gda_connection_statement_execute_non_select > > (database->_priv->conn, stmt, NULL, NULL, &error__); > > > > But the result is the same in both cases: suddenly, it stops processing > > insertions (that didn't happen wih libgda2.3). > > What database providers do you use (PostgreSQL, MySQL, SQlite, a mix > of all the above)? Also what connection option do you specify when you > open the connection (specifically do you use the > GDA_CONNECTION_OPTIONS_THREAD_SAFE option)? We use only MySQl. Yes, sorry, I forgot to mention that; I tried to use GDA_CONNECTION_OPTIONS_THREAD_SAFE but the code didn't compile. I did a search in libgda 4.0.6 src (wich is what we're using now) and I just saw one mention of it in gda-connection.h. I thought that it was only for future or development versions because that flag still seems to not to be working in 4.0.6. This is what we use now: db->_priv->conn = gda_connection_open_from_string (db->_priv->provider, db->_priv->dsn, db->_priv->db_auth, GDA_CONNECTION_OPTIONS_DONT_SHARE, NULL); So, I guess that we should use the development versión to use GDA_CONNECTION_OPTIONS_THREAD_SAFE. I'm going to try it to check if it solves the problem, although I'm a bit worried because it is not the stable version. In the meantime, do you know if there are some way to circunvent this problem without using the very latest code? Would you suggest to use development version in a production environment? Thanks a lot, Alberto. |