Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result objects should close the sockets where the results come from #638

Closed
wants to merge 1 commit into from

Conversation

jdferreira
Copy link

The XMLResult never closed the source file where the result was coming from, resulting in "too man opened files" being raised when processing large amounts of SPARQL queries. I have added a line of code to the appropriate file, but I am not sure whether other result parsers need to have the same type of fix added to them.

The XMLResult never closed the source file where the result was coming from, resulting in "too man opened files" being raised when processing large amounts of SPARQL queries
@jdferreira jdferreira changed the title Close the socket Result objects should close the sockets where the results come from Jul 7, 2016
@joernhees joernhees added bug Something isn't working parsing Related to a parsing. discussion labels Oct 15, 2016
@joernhees joernhees added this to the rdflib 4.2.2 milestone Oct 15, 2016
@joernhees
Copy link
Member

tests fail... are you sure this behavior still exists in 4.2.2-dev (current master)?

@gromgull
Copy link
Member

Since that method doesn't open the result, it also shouldn't close it.

However, the SPARQLStore probably should, here:

https://github.com/RDFLib/rdflib/blob/master/rdflib/plugins/stores/sparqlstore.py#L333

We could do:

with contextlib.closing(SPARQLWrapper.query(self).response) as res: return Result.parse(res)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion parsing Related to a parsing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants