Jax-ws endpoint blocking on socket load since Java 8 update

We are using the JAX-WS implementation with JAXB for web services, we recently updated it to jdk 8 as then we have an issue where our endpoint is sending responses. After digging into this, I realized that the endpoint thread is blocking when writing to the socket.

Here is the server side thread stack trace when execution is blocked, as you can see it blocks on writing. The client side also blocks reads until the timeout is reached.

Daemon Thread [jaxws-engine-WSEndpointSever::WSEnpointServer-3-thread-1] (Suspended)    
    owns: Object  (id=8288) 
    owns: Request$WriteStream  (id=8289)    
    SocketDispatcher.write0(FileDescriptor, long, int) line: not available [native method] [local variables unavailable]    
    SocketDispatcher.write(FileDescriptor, long, int) line: 51  
    IOUtil.writeFromNativeBuffer(FileDescriptor, ByteBuffer, long, NativeDispatcher) line: 93   
    IOUtil.write(FileDescriptor, ByteBuffer, long, NativeDispatcher) line: 65   
    SocketChannelImpl.write(ByteBuffer) line: 470   
    Request$WriteStream.write(byte[], int, int) line: 391   
    ChunkedOutputStream.writeChunk() line: 125 [local variables unavailable]    
    ChunkedOutputStream.flush() line: 159 [local variables unavailable] 
    PlaceholderOutputStream.flush() line: 449 [local variables unavailable] 
    ServerConnectionImpl$1(FilterOutputStream).flush() line: 140 [local variables unavailable]  
    UTF8OutputStreamWriter.flush() line: 138    
    XMLStreamWriterImpl.flush() line: 397   
    XMLStreamWriterFactory$HasEncodingWriter(XMLStreamWriterFilter).flush() line: 56    
    SAAJMessage.writeTo(XMLStreamWriter) line: 365  
    MessageWrapper.writeTo(XMLStreamWriter) line: 206   
    StreamSOAP11Codec(StreamSOAPCodec).encode(Packet, OutputStream) line: 129   
    SOAPBindingCodec.encode(Packet, OutputStream) line: 227 
    ServerAdapter(HttpAdapter).encodePacket(Packet, WSHTTPConnection, Codec) line: 474  
    HttpAdapter.access$100(HttpAdapter, Packet, WSHTTPConnection, Codec) line: 90   
    HttpAdapter$HttpToolkit.handle(WSHTTPConnection) line: 716  
    ServerAdapter(HttpAdapter).handle(WSHTTPConnection) line: 260   
    WSHttpHandler.handleExchange(HttpExchange) line: 98 
    WSHttpHandler.access$000(WSHttpHandler, HttpExchange) line: 47  
    WSHttpHandler$HttpHandlerRunnable.run() line: 122   
    ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1142  
    ThreadPoolExecutor$Worker.run() line: 617   
    Thread.run() line: 745  

      

This happens in random circumstances where the responses are short, it hardly happens, but it happens very often with large responses.

Is there anything new in java 8 that we should be aware of?

This is how the webservice is basically published

Server side

        Endpoint endpoint = Endpoint.create(inServiceImpl );
        endpoint.setExecutor( m_threadPoolExecutor );

        SOAPBinding binding = (SOAPBinding) endpoint.getBinding();


        List<Handler> handlerChain = new LinkedList<Handler>();
        handlerChain.add( new SOAPTraceHandler( jaxEndopoint.getEndPointURL(),jaxEndopoint.getService() ) );
        binding.setHandlerChain( handlerChain );


        // publish the endpoint and make available.
        endpoint.publish( jaxEndopoint.getEndPointURL() );

      

Client side

    m_service = proxy.getPort( Service.class );

    BindingProvider binding = (BindingProvider) m_service;
    Map<String, Object> ctxt = binding.getRequestContext();
    ctxt.put(JAXWSProperties.REQUEST_TIMEOUT, 50000);

    //run method.
    m_service.runMethod(Payload);

      

Could this be related to the Chunked transmission? I haven't found a way to turn off the encoded encoding for the answer, can I turn it off?

I also tried using the dock server as a container using WSServlet, then I move on to the following traces:

nov 10, 2014 4:20:14 EM com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
SEVERE: caught throwable
javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: com.sun.istack.SAXException2: timeout
org.eclipse.jetty.io.EofException: timeout
javax.xml.transform.TransformerException: com.sun.istack.SAXException2: timeout
org.eclipse.jetty.io.EofException: timeout]
at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:322)
at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)
at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)
at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:320)
at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:93)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:454)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:366)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:745)

      

Thrown by: javax.xml.bind.MarshalException - with associated exception: [com.sun.istack.SAXException2: com.sun.istack.SAXException2: timeout org.eclipse.jetty.io.EofException: timeout javax.xml.transform .TransformerException: com.sun.istack.SAXException2: org.eclipse.jetty.io.EofException: timeout]

Your help would be much appreciated. Thanks in advance.

Sincerely.

+3


source to share





All Articles