I am getting sockettimeeout exception on reading data from inputstream
source code
public void clientData(HttpServletRequest request, HttpServletResponse response){
InputStream in = request.getInputStream();
String body = null;
body = IOUtils.toString(in);
}
org.apache.catalina.connector.ClientAbortException: java.net.SocketTimeoutException|
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:348)|
at org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:663)|
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:370)|
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:183)|
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)|
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)|
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)|
at java.io.InputStreamReader.read(InputStreamReader.java:184)|
at java.io.Reader.read(Reader.java:140)|
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1680)|
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1659)|
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1636)|
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1583)|
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1608)|
at org.apache.commons.io.IOUtils.toString(IOUtils.java:668)|
at org.apache.commons.io.IOUtils.toString(IOUtils.java:646)|
Caused by: java.net.SocketTimeoutException|
at org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:201)|
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:235)|
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:216)|
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1282)|
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1225)|
at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:737)|
at org.apache.coyote.http11.Http11InputBuffer.access$300(Http11InputBuffer.java:42)|
at org.apache.coyote.http11.Http11InputBuffer$SocketInputBuffer.doRead(Http11InputBuffer.java:1120)|
at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:140)|
at org.apache.coyote.http11.Http11InputBuffer.doRead(Http11InputBuffer.java:262)|
at org.apache.coyote.Request.doRead(Request.java:581)|
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:344)|
... 59 more|
server.xml is with below configurations
connectionTimeout="20000" maxThread="150"
There are thousands of client concurrently accessing tomcat server
Note:
Not able to reproduce the above case, Sometimes this exception occurs
Exception occurred after reaching 20seconds (connectionTimeout) in server.xml
question from:
https://stackoverflow.com/questions/66060077/sockettimeoutexception-on-getting-data-from-inputstream-in-tomcat 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…