cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-6943) Dead lock on Async Response when timeout is set
Date Tue, 02 Aug 2016 10:45:20 GMT

    [ https://issues.apache.org/jira/browse/CXF-6943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15403755#comment-15403755
] 

Sergey Beryozkin edited comment on CXF-6943 at 8/2/16 10:44 AM:
----------------------------------------------------------------

It was not a breaking change. It was a fix preventing the users writing an invalid JAX-RS
2.0 code - we can't have CXF supporting the invalid code.

The fact WADL does not correctly represent such methods is a minor issue can which can be
addressed (I'll open a minor enhancement request and let you know). Most likely one would
need to depend on some extra annotations already recognized by the WADL generator but some
fix may be needed there to check if it is AsyncResponse. 

I'll check on AsyncResponse and the impl-only restriction in 3.1.7  


was (Author: sergey_beryozkin):
It was not a breaking change. It was a fix preventing the users writing an /invalid JAX-RS
2.0 code - we can't have CXF supporting the invalid code.

The fact WADL does not correctly represent such methods is a minor issue can which can be
addressed (I'll open a minor enhancement request and let you know). Most likely one would
need to depend on some extra annotations already recognized by the WADL generator but some
fix may be needed there to check if it is AsyncResponse. 

I'll check on AsyncResponse and the impl-only restriction in 3.1.7  

> Dead lock on Async Response when timeout is set
> -----------------------------------------------
>
>                 Key: CXF-6943
>                 URL: https://issues.apache.org/jira/browse/CXF-6943
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.4, 3.1.6
>         Environment: The bug was detected on :
>   - Java 1.7.0_11
>   - Tomcat 8.0.23
>   - CXF 3.0.4
>   - Red Hat 6.5
> The bug is also available on :
>   - Java 1.8.0_77
>   - Tomcat 8.0.35
>   - CXF 3.1.6
>   - Red Hat 6.5
>            Reporter: MOIRE Antony
>            Assignee: Sergey Beryozkin
>              Labels: test
>             Fix For: 3.0.10, 3.1.7, 3.2.0
>
>         Attachments: Main_Thread_error.txt, Working_Thread_error.txt, async-response-test.zip
>
>
> Hello,
> When using AsyncResponse with timeout and an external thread for the treatment, it seems
that a dead lock appears between the main http thread and the treatment thread when the treatment
thread finished before the main thread :
> Here is the code which reproduces this issue :
>     public Response asyncResponseTestKo(HttpServletRequest request, final AsyncResponse
ar) {
>         Response r = null;
>         LOGGER.info("Get request asyncResponseTestKo");
>         ar.setTimeout(10, TimeUnit.SECONDS);
>         poolExecutor.execute(new Runnable() {
>             @Override
>             public void run() {
>                 ar.resume(Response.ok().build());
>             }
>         });
>         try {
>             Thread.sleep(2000);
>         } catch (InterruptedException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>         return r;
>     }
> The main thread error is :
> 2016-06-15 14:47:44
> "http-nio-9080-exec-1" - Thread t@25
>    java.lang.Thread.State: BLOCKED
> 	at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.suspendContinuationIfNeeded(AsyncResponseImpl.java:263)
> 	- waiting to lock <792a9e17> (a org.apache.cxf.jaxrs.impl.AsyncResponseImpl) owned
by "pool-1-thread-1" t@26
> 	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:191)
> 	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
> 	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
> 	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> 	- locked <5f36a728> (a org.apache.cxf.phase.PhaseInterceptorChain)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254)
> 	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
> 	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:222)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> 	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
> 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> 	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
> 	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
> 	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
> 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
> 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
> 	- locked <32b056bb> (a org.apache.tomcat.util.net.NioChannel)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> 	at java.lang.Thread.run(Thread.java:745)
>    Locked ownable synchronizers:
> 	- locked <623f9d31> (a java.util.concurrent.ThreadPoolExecutor$Worker)
> The treatment thread error is :
> 2016-06-15 14:48:15
> "pool-1-thread-1" - Thread t@26
>    java.lang.Thread.State: WAITING
> 	at java.lang.Object.wait(Native Method)
> 	- waiting on <19991ed0> (a org.apache.coyote.AsyncStateMachine)
> 	at java.lang.Object.wait(Object.java:502)
> 	at org.apache.coyote.AsyncStateMachine.pauseNonContainerThread(AsyncStateMachine.java:430)
> 	at org.apache.coyote.AsyncStateMachine.asyncDispatch(AsyncStateMachine.java:300)
> 	at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:863)
> 	at org.apache.coyote.Request.action(Request.java:378)
> 	at org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:238)
> 	- locked <60e59a3c> (a java.lang.Object)
> 	at org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:194)
> 	at org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:188)
> 	at org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.redispatch(Servlet3ContinuationProvider.java:125)
> 	at org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.resume(Servlet3ContinuationProvider.java:131)
> 	at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.doResumeFinal(AsyncResponseImpl.java:96)
> 	- locked <792a9e17> (a org.apache.cxf.jaxrs.impl.AsyncResponseImpl)
> 	at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.doResume(AsyncResponseImpl.java:89)
> 	- locked <792a9e17> (a org.apache.cxf.jaxrs.impl.AsyncResponseImpl)
> 	at org.apache.cxf.jaxrs.impl.AsyncResponseImpl.resume(AsyncResponseImpl.java:78)
> 	at test.AsyncResponseTestImpl$2.run(AsyncResponseTestImpl.java:72)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
>    Locked ownable synchronizers:
> 	- locked <4f68ae20> (a java.util.concurrent.ThreadPoolExecutor$Worker)
> Best regards



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message