On 13/02/2019 11:34, Martynas Jusevičius wrote:
Are you closing the QueryExecution objects?
That is certainly something to look for. The fact it is ~6 connections
suggest that as well.
There's help for this - QueryExecution is a Java AutoCloseable so you
can write:
try(QueryExecution exec = QueryExecutionFactory.sparqlService...) {
ResultSet objects = exec.execSelect();
...
}
and the QueryExecution.close is always done.
or use RDFConnection which has idioms to query and process the results
where the methods do te execution lifecycle:
RDFConnection.queryResultSet
RDFConnection.querySelect
Andy
I've experienced similar stuff with Apache HTTP Client that would reach the
limit of connections per route and then would just hang without any error
messages.
On Wed, Feb 13, 2019 at 10:04 AM Bart van Leeuwen <
bart_van_leeu...@netage.nl> wrote:
So in the mean time I've been trying to understand the issue a bit better.
From 3.1.0 to 3.2.0 the most notable difference is the HTTPClient package
which introduces the PoolingHttpClientConnectionManager
( this is visibile in the stacktrace )
Since we run in Tomee ( Tomcat with EJB ) this is the cause of our
problems:
https://stackoverflow.com/questions/27298746/using-poolinghttpclientconnectionmanager-in-ejb-container
After adding the following lines to our constructor:
HttpClient httpclient = HttpClients.custom().build();
HttpOp.setDefaultHttpClient(httpclient);
our problems are solved!
Is there some background information on this (or should there be some
documentation aditions)
Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen
twitter: @semanticfire
tel. +31(0)6-53182997
Netage B.V.
http://netage.nl
Esdoornstraat 3
3461ER Linschoten
The Netherlands
From: Bart van Leeuwen <bart_van_leeu...@netage.nl>
To: users@jena.apache.org
Date: 12-02-2019 22:49
Subject: QueryExecution.exec stops working in Java Web Application
------------------------------
Hi,
We have a web application which uses the following code to connect to a
external endpoint
QueryExecution exec =
QueryExecutionFactory.sparqlService(Config.getConfig("endpoint"), kroQuery);
ResultSet objects = exec.execSelect();
This runs fine with Jena up to 3.1.0
However with later versions we run into the issue that after 6 requests
they don't return, upon killing the application ( or server ) this is
visible on the console:
====
WARNING - The web application [ROOT] is still processing a request that
has yet to finish. This is very likely to create a memory leak. You can
control the time allowed for requests to finish by using the unloadDelay
attribute of the standard Context implementation. Stack trace of request
processing thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
org.apache.http.pool.PoolEntryFuture.await(PoolEntryFuture.java:138)
org.apache.http.pool.AbstractConnPool.getPoolEntryBlocking(AbstractConnPool.java:306)
org.apache.http.pool.AbstractConnPool.access$000(AbstractConnPool.java:64)
org.apache.http.pool.AbstractConnPool$2.getPoolEntry(AbstractConnPool.java:192)
org.apache.http.pool.AbstractConnPool$2.getPoolEntry(AbstractConnPool.java:185)
org.apache.http.pool.PoolEntryFuture.get(PoolEntryFuture.java:107)
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:276)
org.apache.http.impl.conn.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:263)
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:190)
org.apache.http.impl.client.cache.CachingExec.callBackend(CachingExec.java:592)
org.apache.http.impl.client.cache.CachingExec.handleCacheMiss(CachingExec.java:356)
org.apache.http.impl.client.cache.CachingExec.execute(CachingExec.java:275)
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1054)
org.apache.jena.riot.web.HttpOp.execHttpGet(HttpOp.java:281)
org.apache.jena.riot.web.HttpOp.execHttpGet(HttpOp.java:340)
org.apache.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:323)
org.apache.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:282)
org.apache.jena.sparql.engine.http.QueryEngineHTTP.execResultSetInner(QueryEngineHTTP.java:342)
org.apache.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:334)
webservice.KroService.getBlockAsJson(KroService.java:90)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:252)
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:251)
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:419)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:169)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
====
Any hint would be greatly appreciated.
Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen
twitter: @semanticfire
tel. +31(0)6-53182997
Netage B.V.
*http://netage.nl* <http://netage.nl/>
Esdoornstraat 3
3461ER Linschoten
The Netherlands