[redland-dev] 0.9.19: Segmentation fault (mysql parse in)

Dave Beckett dave.beckett at bristol.ac.uk
Mon Nov 8 23:48:39 GMT 2004


On Mon, 8 Nov 2004 22:45:49 +0100 (MET)
Sebastian Dietzold <sebastian at dietzold.de> wrote:

> quote Morten Frederiksen (8.11.2004):
> 
> > On Monday 08 November 2004 20:36, Sebastian Dietzold wrote:
> >> Program received signal SIGSEGV, Segmentation fault.
> >> 0x08056de8 in ?? ()
> >> (gdb) bt
> >> #0  0x08056de8 in ?? ()
> >> #1  0x404699e0 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
> >> #2  0x4046911e in _nss_db_endservent () from /lib/libnss_db.so.2
> > This looks like it may be failing while resolving the provided host
> > name,'server'.
> >
> > Can you get the IP address by 'host' or e.g. 'ping'?
> 
> yes, i can resolve the ip. a connect with the mysql command client
> also works.

Not sure if this is it, but *if* I do run the rdfproc command with bad
arguments such as host='fake', I do get a crash.  Like this:

./rdfproc -s mysql -t "host='fake',database='test',user='test',password='XXXX'" -n archive parse foaf.rdf
lt-rdfproc: Error - Connection to MySQL database
fake:3306 name test as user test failed: Unknown MySQL Server Host
'fake' (1) Segmentation fault (core dumped)

So maybe there is something wrong in that area.  Could be your crash
happens before the error message above gets printed?

I just noticed from the code that if the connection fails in
mysql_real_connect, the code continues to call
mysql_real_escape_string on a failed connection which then dies.

Patch below to fix:

This makes it just stop like this:

./rdfproc -s mysql -t host='fake',database='test',user='test',password='XXXX' -n archive parse foaf.rdf
rdfproc: Error - Connection to MySQL database fake:3306 name redtest as user redtest failed: Unknown MySQL Server Host 'fake' (1)
rdfproc: Failed to open mysql storage 'archive'


If you could try this patch, let me know if it fixes it.  Thanks.

Dave

--- rdf_storage_mysql.c.~1.35.~	Sun Nov  7 21:06:01 2004
+++ rdf_storage_mysql.c	Mon Nov  8 23:46:30 2004
@@ -314,6 +314,7 @@
                   context->user, mysql_error(&context->connection));
     status=0-mysql_errno(&context->connection);
     context->connection_open=0;
+    return status;
   }
 
   /* Create tables, if new and not existing */



More information about the redland-dev mailing list