[jira] [Commented] (JENA-1702) InputStream for HTTP constructModel queries are not closed
[ https://issues.apache.org/jira/browse/JENA-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816327#comment-16816327 ] A. Soroka commented on JENA-1702: - Hi, [~trueg]! Thanks for the report. It could be that we're looking in two different code paths, but my tracing of {{RDFConnection.queryConstruct(String)}} leads me (via {{QueryExecution.execConstruct() => QueryEngineHTTP.execConstruct() => QueryEngineHTTP.execConstruct(Model)}}} ) to [this|https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java#L440] method: {code:java} private Model execModel(Model model) { Pair p = execConstructWorker(modelContentType) ; try(InputStream in = p.getLeft()) { Lang lang = p.getRight() ; RDFDataMgr.read(model, in, lang); } catch (IOException ex) { IO.exception(ex); } finally { this.close(); } return model; } {code} in which it seems that the {{InputStream}} is indeed being closed via {{try-with-resource}} at line 440. Can you describe the code path you found in which it is not? Another question: are you closing the connection between each request (it looks like that from your code)? I think that's not ideal-- I believe you can safely reuse {{RDFConnection}} for a multi-request "conversation". > InputStream for HTTP constructModel queries are not closed > -- > > Key: JENA-1702 > URL: https://issues.apache.org/jira/browse/JENA-1702 > Project: Apache Jena > Issue Type: Bug > Components: ARQ >Affects Versions: Jena 3.10.0 >Reporter: Sebastian Trüg >Priority: Major > > I am accessing a Fuseki installation as follows: > {code:java} > String uri = fusekiHost + "/" + dataset; > RDFConnection conn = RDFConnectionFuseki.create().destination(uri).build(); > try(RDFConnection conn = createConnection(dataModelDs)) { > Model model = conn.queryConstruct("construct { ?s ?p ?o . } where { ?s ?p > ?o . }"); > return model; > }{code} > The problem is that after 5 of these requests the Spring boot application > this code runs in blocks due to the PoolingHttpClientConnectionManager > running out of free routes. > After lots of debugging I noticed that the InputStream that is used to read > the data is never closed. > InputStreams from "select" requests are closed in QueryEngineHTTP::close due > to "retainedConnection" being set. > The same is not true for "construct" queries since their results are parsed > via RDFDataMgr which does not close the InputStream. > I do not understand the code well enough to propose a proper solution but > maybe just setting "retainedConnection" for construct queries would be > enough? Either way, I think the stream needs to be closed somehow. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-1702) InputStream for HTTP constructModel queries are not closed
[ https://issues.apache.org/jira/browse/JENA-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816382#comment-16816382 ] A. Soroka commented on JENA-1702: - Ha! Thanks, [~rvesse], the fix for JENA-1657 was exactly at the place I was asking [~trueg] to look! No wonder I didn't see anything wrong there. > InputStream for HTTP constructModel queries are not closed > -- > > Key: JENA-1702 > URL: https://issues.apache.org/jira/browse/JENA-1702 > Project: Apache Jena > Issue Type: Bug > Components: ARQ >Affects Versions: Jena 3.10.0 >Reporter: Sebastian Trüg >Priority: Major > Fix For: Jena 3.11.0 > > > I am accessing a Fuseki installation as follows: > {code:java} > String uri = fusekiHost + "/" + dataset; > RDFConnection conn = RDFConnectionFuseki.create().destination(uri).build(); > try(RDFConnection conn = createConnection(dataModelDs)) { > Model model = conn.queryConstruct("construct { ?s ?p ?o . } where { ?s ?p > ?o . }"); > return model; > }{code} > The problem is that after 5 of these requests the Spring boot application > this code runs in blocks due to the PoolingHttpClientConnectionManager > running out of free routes. > After lots of debugging I noticed that the InputStream that is used to read > the data is never closed. > InputStreams from "select" requests are closed in QueryEngineHTTP::close due > to "retainedConnection" being set. > The same is not true for "construct" queries since their results are parsed > via RDFDataMgr which does not close the InputStream. > I do not understand the code well enough to propose a proper solution but > maybe just setting "retainedConnection" for construct queries would be > enough? Either way, I think the stream needs to be closed somehow. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-1702) InputStream for HTTP constructModel queries are not closed
[ https://issues.apache.org/jira/browse/JENA-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816385#comment-16816385 ] Sebastian Trüg commented on JENA-1702: -- Wow, you guys are fast. Thank you so much for the reply. I will give the snapshot a try. > InputStream for HTTP constructModel queries are not closed > -- > > Key: JENA-1702 > URL: https://issues.apache.org/jira/browse/JENA-1702 > Project: Apache Jena > Issue Type: Bug > Components: ARQ >Affects Versions: Jena 3.10.0 >Reporter: Sebastian Trüg >Priority: Major > Fix For: Jena 3.11.0 > > > I am accessing a Fuseki installation as follows: > {code:java} > String uri = fusekiHost + "/" + dataset; > RDFConnection conn = RDFConnectionFuseki.create().destination(uri).build(); > try(RDFConnection conn = createConnection(dataModelDs)) { > Model model = conn.queryConstruct("construct { ?s ?p ?o . } where { ?s ?p > ?o . }"); > return model; > }{code} > The problem is that after 5 of these requests the Spring boot application > this code runs in blocks due to the PoolingHttpClientConnectionManager > running out of free routes. > After lots of debugging I noticed that the InputStream that is used to read > the data is never closed. > InputStreams from "select" requests are closed in QueryEngineHTTP::close due > to "retainedConnection" being set. > The same is not true for "construct" queries since their results are parsed > via RDFDataMgr which does not close the InputStream. > I do not understand the code well enough to propose a proper solution but > maybe just setting "retainedConnection" for construct queries would be > enough? Either way, I think the stream needs to be closed somehow. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-1702) InputStream for HTTP constructModel queries are not closed
[ https://issues.apache.org/jira/browse/JENA-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816386#comment-16816386 ] Sebastian Trüg commented on JENA-1702: -- Oh, and sorry for the duplicate, I will make sure to better search for closed tickets next time. :) > InputStream for HTTP constructModel queries are not closed > -- > > Key: JENA-1702 > URL: https://issues.apache.org/jira/browse/JENA-1702 > Project: Apache Jena > Issue Type: Bug > Components: ARQ >Affects Versions: Jena 3.10.0 >Reporter: Sebastian Trüg >Priority: Major > Fix For: Jena 3.11.0 > > > I am accessing a Fuseki installation as follows: > {code:java} > String uri = fusekiHost + "/" + dataset; > RDFConnection conn = RDFConnectionFuseki.create().destination(uri).build(); > try(RDFConnection conn = createConnection(dataModelDs)) { > Model model = conn.queryConstruct("construct { ?s ?p ?o . } where { ?s ?p > ?o . }"); > return model; > }{code} > The problem is that after 5 of these requests the Spring boot application > this code runs in blocks due to the PoolingHttpClientConnectionManager > running out of free routes. > After lots of debugging I noticed that the InputStream that is used to read > the data is never closed. > InputStreams from "select" requests are closed in QueryEngineHTTP::close due > to "retainedConnection" being set. > The same is not true for "construct" queries since their results are parsed > via RDFDataMgr which does not close the InputStream. > I do not understand the code well enough to propose a proper solution but > maybe just setting "retainedConnection" for construct queries would be > enough? Either way, I think the stream needs to be closed somehow. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-1702) InputStream for HTTP constructModel queries are not closed
[ https://issues.apache.org/jira/browse/JENA-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816392#comment-16816392 ] A. Soroka commented on JENA-1702: - No prob [~trueg]! Always better to file and we can sort out dupes. If you don't file, we may not have a chance to catch something new. > InputStream for HTTP constructModel queries are not closed > -- > > Key: JENA-1702 > URL: https://issues.apache.org/jira/browse/JENA-1702 > Project: Apache Jena > Issue Type: Bug > Components: ARQ >Affects Versions: Jena 3.10.0 >Reporter: Sebastian Trüg >Priority: Major > Fix For: Jena 3.11.0 > > > I am accessing a Fuseki installation as follows: > {code:java} > String uri = fusekiHost + "/" + dataset; > RDFConnection conn = RDFConnectionFuseki.create().destination(uri).build(); > try(RDFConnection conn = createConnection(dataModelDs)) { > Model model = conn.queryConstruct("construct { ?s ?p ?o . } where { ?s ?p > ?o . }"); > return model; > }{code} > The problem is that after 5 of these requests the Spring boot application > this code runs in blocks due to the PoolingHttpClientConnectionManager > running out of free routes. > After lots of debugging I noticed that the InputStream that is used to read > the data is never closed. > InputStreams from "select" requests are closed in QueryEngineHTTP::close due > to "retainedConnection" being set. > The same is not true for "construct" queries since their results are parsed > via RDFDataMgr which does not close the InputStream. > I do not understand the code well enough to propose a proper solution but > maybe just setting "retainedConnection" for construct queries would be > enough? Either way, I think the stream needs to be closed somehow. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-1702) InputStream for HTTP constructModel queries are not closed
[ https://issues.apache.org/jira/browse/JENA-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816394#comment-16816394 ] Sebastian Trüg commented on JENA-1702: -- Confirmed. 3.11.0-SNAPSHOT fixes the problem! > InputStream for HTTP constructModel queries are not closed > -- > > Key: JENA-1702 > URL: https://issues.apache.org/jira/browse/JENA-1702 > Project: Apache Jena > Issue Type: Bug > Components: ARQ >Affects Versions: Jena 3.10.0 >Reporter: Sebastian Trüg >Priority: Major > Fix For: Jena 3.11.0 > > > I am accessing a Fuseki installation as follows: > {code:java} > String uri = fusekiHost + "/" + dataset; > RDFConnection conn = RDFConnectionFuseki.create().destination(uri).build(); > try(RDFConnection conn = createConnection(dataModelDs)) { > Model model = conn.queryConstruct("construct { ?s ?p ?o . } where { ?s ?p > ?o . }"); > return model; > }{code} > The problem is that after 5 of these requests the Spring boot application > this code runs in blocks due to the PoolingHttpClientConnectionManager > running out of free routes. > After lots of debugging I noticed that the InputStream that is used to read > the data is never closed. > InputStreams from "select" requests are closed in QueryEngineHTTP::close due > to "retainedConnection" being set. > The same is not true for "construct" queries since their results are parsed > via RDFDataMgr which does not close the InputStream. > I do not understand the code well enough to propose a proper solution but > maybe just setting "retainedConnection" for construct queries would be > enough? Either way, I think the stream needs to be closed somehow. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-1702) InputStream for HTTP constructModel queries are not closed
[ https://issues.apache.org/jira/browse/JENA-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16817644#comment-16817644 ] Rob Vesse commented on JENA-1702: - [~trueg] No worries about the duplicate, in this case your bug actually describes the problem better than either the PR or the associated JIRA IMO I happened to remember that we'd had a similar bug recently and it took me quite a lot of searching to find the corresponding duplicate! > InputStream for HTTP constructModel queries are not closed > -- > > Key: JENA-1702 > URL: https://issues.apache.org/jira/browse/JENA-1702 > Project: Apache Jena > Issue Type: Bug > Components: ARQ >Affects Versions: Jena 3.10.0 >Reporter: Sebastian Trüg >Priority: Major > Fix For: Jena 3.11.0 > > > I am accessing a Fuseki installation as follows: > {code:java} > String uri = fusekiHost + "/" + dataset; > RDFConnection conn = RDFConnectionFuseki.create().destination(uri).build(); > try(RDFConnection conn = createConnection(dataModelDs)) { > Model model = conn.queryConstruct("construct { ?s ?p ?o . } where { ?s ?p > ?o . }"); > return model; > }{code} > The problem is that after 5 of these requests the Spring boot application > this code runs in blocks due to the PoolingHttpClientConnectionManager > running out of free routes. > After lots of debugging I noticed that the InputStream that is used to read > the data is never closed. > InputStreams from "select" requests are closed in QueryEngineHTTP::close due > to "retainedConnection" being set. > The same is not true for "construct" queries since their results are parsed > via RDFDataMgr which does not close the InputStream. > I do not understand the code well enough to propose a proper solution but > maybe just setting "retainedConnection" for construct queries would be > enough? Either way, I think the stream needs to be closed somehow. -- This message was sent by Atlassian JIRA (v7.6.3#76005)