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

Sebastian Dietzold sebastian at dietzold.de
Tue Nov 9 10:17:26 GMT 2004


quote Dave Beckett (8.11.2004):

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

ok, i've used the patch but it does not fix the problem.

(gdb) run
Starting program: /opt/redland-0.9.19/bin/rdfproc -s mysql -t host=\'outlaw\',database=\'seebiRedland\',user=\'seebi\',password=\'xxx\' -n archive parse http://sebastian.dietzold.de/rdf/foaf.rdf

Program received signal SIGSEGV, Segmentation fault.
0x08056dc9 in ?? ()
(gdb) bt
#0  0x08056dc9 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
#3  0x404693b3 in _nss_db_getservbyname_r () from /lib/libnss_db.so.2
#4  0x40428a83 in getservbyname_r () from /lib/libc.so.6
#5  0x40428931 in getservbyname () from /lib/libc.so.6
#6  0x401b2fc9 in mysql_once_init () from /opt/mysql-3.23.58/lib/mysql/libmysqlclient.so.10
#7  0x401b5128 in mysql_init () from /opt/mysql-3.23.58/lib/mysql/libmysqlclient.so.10
#8  0x4003b56f in librdf_storage_mysql_init (storage=0x8055910, name=0xbffffc1d "archive", options=0x80557e0)
     at rdf_storage_mysql.c:301
#9  0x4002aa02 in librdf_new_storage_from_factory (world=0x8050a18, factory=0x8054e10, name=0xbffffc1d "archive",
     options=0x80557e0) at rdf_storage.c:448
#10 0x4002a777 in librdf_new_storage_with_options (world=0x8050a18, storage_name=0xbffffbca "mysql",
     name=0xbffffc1d "archive", options=0x8055680) at rdf_storage.c:337
#11 0x0804b26e in main (argc=1, argv=0xbffffac4) at rdfproc.c:516

i ve added a new host line in my /etc/hosts and i also tried it with an 
ip-address instead of a name.

maybe it depends on our nameserver. in fact, we have no unresolvable 
names. every name which is not in the dns, is mapped to a standard host. 
it is a typical root server with confixx admin suite.

but i think, this is not the problem, cause i've also tried it with an 
ip-address.

so long

S.

-- 
http://sebastian.dietzold.de/



More information about the redland-dev mailing list