java.net.SocketTimeoutException:读取tomcat下的超时时间 [英] java.net.SocketTimeoutException: Read timed out under tomcat

查看:447
本文介绍了java.net.SocketTimeoutException:读取tomcat下的超时时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于tomcat的Web应用程序。我间歇性地得到以下异常,

I have a tomcat based web application. I am intermittently getting the following exception,

Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:150)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:532)
    at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:501)
    at org.apache.coyote.http11.InternalInputBuffer$InputStreamInputBuffer.doRead(InternalInputBuffer.java:563)
    at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:124)
    at org.apache.coyote.http11.AbstractInputBuffer.doRead(AbstractInputBuffer.java:346)
    at org.apache.coyote.Request.doRead(Request.java:422)
    at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:290)
    at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:431)
    at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:315)
    at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200)
    at java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:385)

不幸的是我无法访问客户端,因此我只想确认可能发生的各种原因,

Unfortunately i don't have access to the client, so i am just trying to confirm on various reasons this can happen,


  1. 服务器正在尝试从请求中读取数据,但其时间超过了从客户端到达的数据的超时值。这里的超时通常是tomcat连接器 - > connectionTimeout属性。

  1. Server is trying to read data from the request, but its taking longer than the timeout value for the data to arrive from the client. Timeout here would typically be tomcat connector -> connectionTimeout attribute.

客户端设置了读取超时,服务器的响应时间要长于响应时间。

Client has a read timeout set, and server is taking longer than that to respond.

我遇到的一个主题是,如果启用了keepalive,可能会发生这种情况。

One of the threads i went through, said this can happen with high concurrency and if the keepalive is enabled.

对于#1,我设定的初始值为20秒,我将其提高到60秒,将测试并查看是否有任何变化。

For #1, the initial value i had set was 20 sec, i have bumped this up to 60sec, will test and see if there are any changes.

同时,如果你们中的任何人能够就此提供专家意见,那将非常有帮助。或者就此而言,您可以考虑哪个原因可能导致此问题。

Meanwhile, if any of you guys can provide you expert opinion on this, that'l be really helpful. Or for that matter any other reason you can think of which might cause this issue.

提前致谢。

Vicky

推荐答案


服务器正在尝试从请求中读取数据,但其耗时超过从客户端到达的数据的超时值。这里的超时通常是tomcat连接器 - > connectionTimeout属性。

Server is trying to read data from the request, but its taking longer than the timeout value for the data to arrive from the client. Timeout here would typically be tomcat connector -> connectionTimeout attribute.

正确。

客户端设置了读取超时,服务器的响应时间比响应时间长。

Client has a read timeout set, and server is taking longer than that to respond.

否。这会导致客户端超时

No. That would cause a timeout at the client.


我经历过的一个主题,说这可能发生具有高并发性并且如果启用了keepalive。

One of the threads i went through, said this can happen with high concurrency and if the keepalive is enabled.

这显然是猜测,而且完全不正确。当且仅当超时内没有数据到达时才会发生这种情况。期。加载和保持活动以及并发与它无关。

That is obviously guesswork, and completely incorrect. It happens if and only if no data arrives within the timeout. Period. Load and keepalive and concurrency have nothing to do with it whatsoever.

这只是意味着客户端没有发送。你不必担心它。浏览器客户端以各种奇怪的方式进出。

It just means the client isn't sending. You don't need to worry about it. Browser clients come and go in all sorts of strange ways.

这篇关于java.net.SocketTimeoutException:读取tomcat下的超时时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆