[redland-dev] crash in librdf_get_query_factory()

F. Eugene Aumson feaumson at gmail.com
Fri Jul 22 06:44:19 EDT 2016


I'm building a C++ application using redland and Wt (http://webtoolkit.eu).
I've got a web form with two combo boxes, one for displaying all the
predicates in my RDF model, and another which I'm trying to dynamically
repopulate with all of the values that are used by the predicate selected
in the first one.

The initial rendering of the web form loads up with both of the combo boxes
populated correctly (an arbitrary predicate in the first combo box, and the
proper values go with it in the second).  However, if you change the
predicate combo box, my program will segfault, in
librdf_get_query_factory(), on the line `if(name && !strcmp(factory->name,
name)) {`, because:

(gdb) print factory->name
$1 = 0x4c25048b64000000 <error: Cannot access memory at address
0x4c25048b64000000>

librdf_get_query_factory() was called by librdf_new_query(), which my code
invoked directly with the following parameters:

(gdb) print world
$3 = (librdf_world *) 0x7fffe5a12340
(gdb) print name
$4 = 0x448f15 "sparql"
(gdb) print uri
$5 = (librdf_uri *) 0x0
(gdb) print query_string
$6 = (const unsigned char *) 0x7fffc8002298 "SELECT DISTINCT ?value WHERE {
?_ <http://www.nps.gov/planTs/pubs/chesapeake/SoilType> ?value }"
(gdb) print base_uri
$7 = (librdf_uri *) 0x0

The world object is the same one I used to construct query objects for the
initial population of the combo boxes, which, again, worked just fine.

I have unit tests around my code which is calling librdf_new_query(), and
in my test runs the code constructs and executes query after query, without
any problems.  So maybe there's something special about this full-fledged
Wt runtime environment? (The stack is 30 calls deep...)  That's obviously a
question for Wt-dev, not redland-dev, but...

Since the crash is happening within librdf, I thought I would start here
first.

I see on the prior line in librdf_get_query_factory() that factory comes
from world->query_factories.  How could a world object get messed up like
this?

Could it be a multi-threading issue?  It COULD be that Wt is using a
different thread to handle the re-population than it did for the initial
population.  I tried rebuilding raptor/rasqal/redland with the
--with-threads configure option, but that didn't seem to have any effect...

Any ideas?  I'm having trouble even coming up with a hypothesis to test...

I could post my code somewhere, if someone would like to take a look, but
it's relatively complicated, what with all the Wt stuff.  My efforts to
recreate the problem in a simple unit test have so far been in vain. :(

Thanks in advance!
Gene
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librdf.org/pipermail/redland-dev/attachments/20160722/6d80d705/attachment.html>


More information about the redland-dev mailing list