Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Payara-Server - Write timeout exceeded when trying to flush the data

I'm receiving this exception from Payara Server 4.1.1.164 when requesting different web services (Jersey 2.23.1) in a deployed JavaEE Application.

I don't know the reason of the exception and either exactly When it appears because in some test environments with the same payara server configuration it turns up but in other never has emerged.

Can Someone help me about what could be the problem here? Any help will be grateful.

[2017-03-22T17:20:03.200+0100] [Payara 4.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=28 _ThreadName=http-thread-pool::http-listener-1(3)] [timeMillis: 1490199603200] [levelValue: 900] [[
  StandardWrapperValve[Alexia-BE]: Servlet.service() for servlet Alexia-BE threw exception
java.io.IOException: Write timeout exceeded when trying to flush the data
    at org.glassfish.grizzly.http.io.OutputBuffer.blockAfterWriteIfNeeded(OutputBuffer.java:1004)
    at org.glassfish.grizzly.http.io.OutputBuffer.write(OutputBuffer.java:715)
    at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:355)
    at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:342)
    at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:161)
    at com.sun.jersey.spi.container.servlet.WebComponent$Writer.write(WebComponent.java:307)
    at com.sun.jersey.spi.container.ContainerResponse$CommittingOutputStream.write(ContainerResponse.java:135)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
    at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
    at java.io.BufferedWriter.write(BufferedWriter.java:230)
    at java.io.Writer.write(Writer.java:157)
    at com.sun.jersey.core.util.ReaderWriter.writeToAsString(ReaderWriter.java:190)
    at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:128)
    at com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:88)
    at com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:58)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
like image 691
bishop Avatar asked Apr 04 '17 13:04

bishop


2 Answers

This exception happens when it takes too long to write a piece of response, probably due to network problems. It doesn't mean that the problem is that writing the whole response takes too much, but writing a piece of a response happens to be too long in some cases, leading to the exception.

You can try increasing the TCP transport write timeout (In Admin console, go to Network → Transports → TCP and modify Write Timeout). or disable it by setting the value to -1.

like image 143
OndroMih Avatar answered Nov 15 '22 02:11

OndroMih


We had this happen to us when wrongly using a @POST annotation on an endpoint instead of a @GET. The endpoint worked fine on most of out developer machines but failed on one dev's machine and, finally, in production. Replacing @POST with @GET fixed the problem for us.

I can only speculate what caused the problem to occur when using POST.

like image 1
anty Avatar answered Nov 15 '22 03:11

anty