Re: [gnome-db] Libgda4.0.6 warnings and segfault



> You need to include another header:
> #include <libgda/sql-parser/gda-sql-parser.h>
> see http://library.gnome.org/devel/libgda/stable/GdaSqlParser.html

I can't believe I didn't see this!!. As I changed from libgda2.3 to libgda3 to 
libgda4 in some days, I didn't realize about this. 

The warning disappeared, lots of thanks.

> > gda-connection.c:1842 1842            g_return_val_if_fail
> > (GDA_IS_STATEMENT (stmt), NULL);
> Can you post the actual lines of code which produce that result as it
> is otherwise very difficult to tell what's wrong.

Yep, I know. I just tried to keep the code simple because it involves 
different execution threads and it could be a bit confusing. Anyway I'm not 
getting anymore that assertion problem. It was completely normal, as I wasn't 
(sig...) including the correct header, so the stmt object wasn't correctly 
created.

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). 

It happens with select and non-select commands:

#0  0x00007f288bd41d29 in pthread_cond_wait@@GLIBC_2.3.2 () 
from /lib/libpthread.so.0
#1  0x00007f288d402cee in gda_connection_lock (lockable=<value optimized out>) 
at gda-connection.c:4275
#2  0x00007f288d403918 in gda_connection_statement_execute_v (cnc=0x764360, 
stmt=0x15e5140, params=0x0, model_usage=GDA_STATEMENT_MODEL_RANDOM_ACCESS,
    last_inserted_row=0x0, error=0x68000de8) at gda-connection.c:1636
#3  0x00007f288d40a3f1 in gda_connection_statement_execute_select 
(cnc=0x764360, stmt=0x15e5140, params=0x0, error=0x68000de8) at 
gda-connection.c:1845
#4  0x000000000040df9d in dbcode_execute_single_command (database=0x70c380, 
buffer=0x68000ed0 "SELECT COUNT(*) from tableX")

#0  0x00007f288bd41d29 in pthread_cond_wait@@GLIBC_2.3.2 () 
from /lib/libpthread.so.0
#1  0x00007f288d402cee in gda_connection_lock (lockable=<value optimized out>) 
at gda-connection.c:4275
#2  0x00007f288d403918 in gda_connection_statement_execute_v (cnc=0x72f180, 
stmt=0x7f27fc52a660, params=0x0,
    model_usage=GDA_STATEMENT_MODEL_RANDOM_ACCESS, last_inserted_row=0x0, 
error=0x69002ee0) at gda-connection.c:1636
#3  0x00007f288d40af54 in gda_connection_statement_execute_non_select 
(cnc=0x72f180, stmt=<value optimized out>, params=0x0, last_insert_row=0x0,
    error=0x69002ee0) at gda-connection.c:1783
#4  0x000000000040da36 in dbcode_execute_no_query (database=0x6e2c00,
    buffer=0x7f27fc1d0e00 "replace into config(conf,value) values 
(\"version\",\"3.2\")") at sim-dbcode.c:359

Oh, and I also tried to do this:
  gda_lockable_lock ((GdaLockable*)database->_priv->conn);
  model = gda_execute_select_command (database->_priv->conn, buffer, 
&error__);
  gda_lockable_unlock ((GdaLockable*)database->_priv->conn);

But same problem.

Thanks and BR,
Alberto.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]