You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2016/11/01 16:44:58 UTC

[jira] [Commented] (CXF-7116) AsyncResponse.resume() infinitely hangs up after first call

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

Sergey Beryozkin commented on CXF-7116:
---------------------------------------

Thanks for providing the test project. I've confirmed it only affects the service code which was created with the embedded Jetty transport, using the code like this one (with the jetty-webapp dep) works:
{code:java}
        org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(port);
        final ServletHolder servletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
        final ServletContextHandler context = new ServletContextHandler();      
        context.setContextPath("/");
        context.addServlet(servletHolder, "/*");  
        servletHolder.setInitParameter("jaxrs.serviceClasses", SimpleResource.class.getName());
        server.setHandler(context);
        server.start();
        // invoke
        server.stop();
{code}

Apparently this failure has been caused by removing the synchronized blocks (CXF-7037), looks like adding a 'synchronized' qualifier to AsyncResponseImpl.suspendContinuationIfNeeded only fixes this issue.  



> AsyncResponse.resume() infinitely hangs up after first call
> -----------------------------------------------------------
>
>                 Key: CXF-7116
>                 URL: https://issues.apache.org/jira/browse/CXF-7116
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.8
>         Environment: * Java - 1.8.0_66 (build 1.8.0_66-b17)
> * CXF - 3.1.8
> * Jetty - 9.3.13.v20161014
> * OS - OS X El Capitan 10.11.6
>            Reporter: Dmytro Khrystiuk
>              Labels: async
>         Attachments: cxf-issue.zip
>
>
> Issue with AsyncResponse happened after upgrade from CXF 3.1.7 to 3.1.8.
> After the second call to REST method server stops to respond. Implementation of method uses AsyncResponse and call to resume() in a separate thread:
>     @GET
>     @Produces(MediaType.TEXT_PLAIN)
>     @Path("/doesNotWork")
>     public void doesNotWork(@Suspended AsyncResponse response) {
>         executorService.submit(() -> {
>             LOGGER.debug("Async task...");
>             response.resume("Success!");
>         });
>     }
> First call to method above works as it should but subsequent calls just hangs up forever. No thread deadlocks were detected.
> The example test (Maven project) is attached to this item.



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