[redland-dev] Model serialization bug

Christopher Schmidt crschmidt at crschmidt.net
Tue Jan 4 11:28:56 PST 2005


On Tue, Jan 04, 2005 at 05:38:52PM +0000, Dave Beckett wrote:
> On Tue, 4 Jan 2005 10:06:07 -0500
> Christopher Schmidt <crschmidt at crschmidt.net> wrote:
> 
> > When running the following script:
> > 
> > import RDF
> > p = RDF.Parser()
> > m = RDF.Model()
> > p.parse_into_model(m, RDF.Uri("http://crschmidt.net/foaf.rdf"))
> > print m
> > 
> > I get a malloc/free error:
> > 
> > rdf_uri.c:201: (librdf_new_uri_from_uri) assertion failed: object 
> > pointer of type librdf_uri is NULL.
> > *** glibc detected *** double free or corruption (fasttop): 0x081ceb80
> > *** Aborted
> 
> I get a slightly different crash (probably because I'm using CVS
> redland) which I've hunted down.
> 
> There are two problems - firstly, it doesn't handle serializing
> with a null base URI properly, so 'print m' isn't going to work.
> 
> This can be fixed in python:
> 
> print m.to_string(base_uri=RDF.Uri("http://example.org/base#"));
> 
> and I'll look at fixing that properly shortly.
> 
> The other thing is a bug in raptor trying to make relative URIs for
> things that it didn't anticipate - URIs with no path.  I've made a
> patch to raptor_uri.c, attached.  Try that out.  (You could
> try the test first: make raptor_uri_test; ./raptor_uri_test )

Before and after the patch, the test works fine. However, I'm still 
getting the crash from raptor_free_statement.

If I set the  MALLOC_CHECK_ environment variable to 0, the python 
example script gets farther:

[1 crschmidt at peanut ~]$ python fail.py
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:atom="http://purl.org/atom/ns#" 
xmlns:dc="http://purl.org/dc/elements/1.1/" 
xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#" 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:rss091="http://purl.org/rss/1.0/modules/rss091#" 
xmlns="http://purl.org/rss/1.0/"></rdf:RDF>

However, it then just sits taking up 100% CPU, and doesn't ever seem to 
finish. If I run it in GDB and kill the process, I get a bt that looks 
like:

#0  0x401ebc7e in mallopt () from /lib/libc.so.6
#1  0x401ebb23 in mallopt () from /lib/libc.so.6
#2  0x401ea6bf in free () from /lib/libc.so.6
#3  0x080fc2bf in PyGrammar_RemoveAccelerators (g=0x11) at 
Parser/acceler.c:47

I'm not at all sure this is a Redland problem at all, but I don't know 
where else to go.

With malloc_check_ explicitly set to 1, I get a large number of errors 
like:

*** glibc detected *** free(): invalid pointer: 0x081db1b8 ***
*** glibc detected *** free(): invalid pointer: 0x081d6338 ***

and an empty RDF/XML serialization (as copy pasted above).

With malloc_check_ set explicitly to 2 or 3, I get the same backtrace as 
I copy pasted previously.

I'm not sure what else I can do to help out here, but the patch given 
did not solve my problems. 

-- 
Christopher Schmidt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnomehack.com/pipermail/redland-dev/attachments/20050104/343f5aef/attachment.pgp


More information about the redland-dev mailing list