[redland-dev] Python: Crash (double-free?) in Model.find_statements()

René Puls kianga at gmail.com
Sun Jun 27 23:28:26 BST 2004


Hi,

I'm getting strange crashes and/or error messages when using the
find_statements() function in connection with a context. The following
Python code triggers the error:

--- cut here ---

#!/usr/local/bin/python
import RDF

RDFSyntaxNS = RDF.NS("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
requestedNode = RDF.Node(uri_string="http://example.org/test")
selfNode = RDF.Node(uri_string="http://example.org/self")

def getTypeOfNode(model,node,inContext):
	typeQueryStatement = RDF.Statement(subject=node, 
	                                   predicate=RDFSyntaxNS.type)
	typeList = model.find_statements(typeQueryStatement, 
	                                 context=inContext)
	# CRASH

coreStorage = RDF.Storage(storage_name="hashes", 
                          name="test", 
                          options_string="new='yes',hash-type='memory'")
coreModel = RDF.Model(coreStorage)

getTypeOfNode(coreModel, requestedNode, selfNode)

--- cut here ---

The program usually crashes with the following error message:

Exception RDF.RedlandWarning: <RDF.RedlandWarning instance at
0x3c1bbc4c> in 'garbage collection' ignored
Fatal Python error: unexpected exception during garbage collection
Abort trap (core dumped)

When there is actual data in the storage (the example above uses an
empty storage), I get the following message instead:

python in free(): error: chunk is already free

The errors go away when I leave out the "context=..." part of the
find_statements() call.

I have already encountered the same errors when using the Perl
interface, so this is probably not Python-specific.

Tested on an OpenBSD 3.5 system.

I already tried to check if there's some problem in the C code, but
considering limited knowledge of the Redland library I'm afraid this
is beyond my current skills. :-)

Kind regards,
René Puls



More information about the redland-dev mailing list