0 Replies Latest reply on Sep 15, 2014 6:31 AM by Chandan Pandey

    Error in spring asyn servlet mode on wildfly 8 server

    Chandan Pandey Newbie

      I have an application which uses Spring Websocket. It works perfect on Tomcat/WAS -recently we tried to port it on Wildfly. When sockjs tries to create connection and send frame on it, undertow server discards the connection :

       

      Caused by: java.io.IOException: An established connection was aborted by the software in your host machine

          at sun.nio.ch.SocketDispatcher.writev0(Native Method) [rt.jar:1.7.0_67]

          at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:55) [rt.jar:1.7.0_67]

          at sun.nio.ch.IOUtil.write(IOUtil.java:148) [rt.jar:1.7.0_67]

          at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524) [rt.jar:1.7.0_67]

          at org.xnio.nio.NioSocketConduit.write(NioSocketConduit.java:159)

          at io.undertow.server.protocol.http.HttpResponseConduit.write(HttpResponseConduit.java:561) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.conduits.ChunkedStreamSinkConduit.doWrite(ChunkedStreamSinkConduit.java:165) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.conduits.ChunkedStreamSinkConduit.write(ChunkedStreamSinkConduit.java:128) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:150)

          at io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:217) [undertow-core-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.spec.ServletOutputStreamImpl.writeBufferBlocking(ServletOutputStreamImpl.java:584) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.spec.ServletOutputStreamImpl.flushInternal(ServletOutputStreamImpl.java:497) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.spec.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:484) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at io.undertow.servlet.spec.HttpServletResponseImpl.flushBuffer(HttpServletResponseImpl.java:433) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

          at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:215) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]

          at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:215) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]

          at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.flushBuffer(SaveContextOnUpdateOrErrorResponseWrapper.java:135) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE]

          at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:81) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE]

          at org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession.writePrelude(XhrStreamingTransportHandler.java:77) [spring-websocket-4.0.0.RELEASE.jar:4.0.0.RELEASE]

          at org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.handleInitialRequest(AbstractHttpSockJsSession.java:135) [spring-websocket-4.0.0.RELEASE.jar:4.0.0.RELEASE]

          ... 82 more

       

      2014-09-15 15:43:14,921 ERROR [io.undertow.request] (default task-25) Blocking request failed HttpServerExchange{ POST /acs/sockjs/cobrowse/agent/812/387wn4wh/xhr_streaming}: java.lang.RuntimeException: java.io.IOException: UT000029: Channel was closed mid chunk, if you have attempted to write chunked data you cannot shutdown the channel until after it has all been written.

          at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:527)

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

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

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

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

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

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

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]

          at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]

      Caused by: java.io.IOException: UT000029: Channel was closed mid chunk, if you have attempted to write chunked data you cannot shutdown the channel until after it has all been written.

       

      I have enabled asyn support for spring dispatcher servlet. Any pointers? I am using wildfly-8.1.0.Final