0 Replies Latest reply on Aug 31, 2018 10:47 AM by Alexandre Dias

    ClosedChannelException on process request POST

    Alexandre Dias Newbie

      Hi,

       

          I got a spring REST application and I got the ClosedChannelException sometimes on endpoint.

       

      Log:

      <code>

      2018-08-28 11:51:29,613 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /my-endpoint: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.RuntimeException: java.nio.channels.ClosedChannelException

      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)

      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)

      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)

      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

      at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:208)

      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)

      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)

      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)

      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

      at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)

      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

      at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

      at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

      at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at org.wildfly.mod_cluster.undertow.metric.RunningRequestsHttpHandler.handleRequest(RunningRequestsHttpHandler.java:69)

      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)

      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)

      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)

      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:209)

      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802)

      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:748)

      Caused by: java.lang.RuntimeException: java.nio.channels.ClosedChannelException

      at io.undertow.servlet.spec.HttpServletRequestImpl.parseFormData(HttpServletRequestImpl.java:763)

      at io.undertow.servlet.spec.HttpServletRequestImpl.getParameterValues(HttpServletRequestImpl.java:688)

      at javax.servlet.ServletRequestWrapper.getParameterValues(ServletRequestWrapper.java:221)

      at org.springframework.web.context.request.ServletWebRequest.getParameterValues(ServletWebRequest.java:160)

      at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.resolveName(RequestParamMethodArgumentResolver.java:175)

      at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:103)

      at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)

      at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:160)

      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:129)

      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)

      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)

      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)

      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)

      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)

      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)

      ... 43 more

      Caused by: java.nio.channels.ClosedChannelException

      at io.undertow.server.protocol.ajp.AjpServerRequestConduit.doRead(AjpServerRequestConduit.java:228)

      at io.undertow.server.protocol.ajp.AjpServerRequestConduit.read(AjpServerRequestConduit.java:199)

      at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)

      at io.undertow.channels.DetachableStreamSourceChannel.read(DetachableStreamSourceChannel.java:209)

      at io.undertow.server.HttpServerExchange$ReadDispatchChannel.read(HttpServerExchange.java:2258)

      at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.doParse(FormEncodedDataDefinition.java:133)

      at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.parseBlocking(FormEncodedDataDefinition.java:251)

      at io.undertow.servlet.spec.HttpServletRequestImpl.parseFormData(HttpServletRequestImpl.java:761)

      ... 58 more

      </code>

       

      The parameters are always the same (hardcoded) and the error happens just sometimes.

      The request is a POST request. The endpoint process thousands request on day. The error only occurs a few times.

       

      JBoss version:

      JBoss EAP 7.0.5.GA

       

      Anyone has idea?