Where should I start investigating SocketTimeoutException: Read timed out

后端 未结 3 1209
抹茶落季
抹茶落季 2020-12-30 00:37

Every now and then I see following stacktrace in the log in which, HttpClient socket times out trying to access text/script content from another se

3条回答
  •  悲哀的现实
    2020-12-30 01:03

    Track 1

    As per the javadocs Httpclient does not seem to have have a default value of the Socket timeout. To answer the question in your update - the session timeout will not be in effect here. Weblogic's default is 30 minutes for session timeout.

    The server session timeout represents the amount of time the HttpSession will be retained in memory if the user has not accessed the server.

    The socket timeout is the amount of time to keep the server socket open while data is being transferred back to the caller. This could even be the server is still processing and writing back data but it's taking rather long and the client has just timed out waiting for it.

    Some links suggest this default is 60 seconds but the javadocs dont say anything, in any case you can set this value to something like 120 seconds to see if it helps

    http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpConnectionParams.html#setSoTimeout(int)

    What you need is to time the timeouts - if that's clear. Meaning - Do these errors appear after 30 sec, 60 sec or 5 minutes of the outgoing request?

    I would change the SO_Timeout and try again

    Track 2 - OS parameters

    There are the recommended BEA parameters for NDD values which govern how long incoming connections are kept open and how many are queued and so on. On Solaris these are got by running

    /usr/sbin/ndd -get /dev/tcp tcp_time_wait_interval 
    /usr/sbin/ndd -get /dev/tcp tcp_conn_req_max_q 
    /usr/sbin/ndd -get /dev/tcp tcp_conn_req_max_q0 
    /usr/sbin/ndd -get /dev/tcp tcp_ip_abort_interval 
    /usr/sbin/ndd -get /dev/tcp tcp_keepalive_interval 
    

    Can you check the Oracle docs for the equivalent commands on Linux, and what values they should be set at. On Solaris my experience is the defaults are not enough and they need to be upped to BEA (Oracle) recommendations

    Track 3: Weblogic / External Access Logs

    Have you enabled HTTP Access Logs on the server? Do these failed requests show up with any response byte size or do they show 0 response size? What error code or HTTP status code is returned?

    Or perhaps these timed out ones are not recorded in the access logs at all?

    Here, I'm assuming the external server on which time outs occur is also Weblogic, if not - this question is directed to the external server team for their equivalent platform.

    ** Others **

    Usually thread dumps help, but the thread dumps should be taken on the server which is having a timeout problem. You are the client and you have successfully obtained a connection, after that it times out when reading the response. So is the external server overloaded ? Lack of threads? CPU high? Too many concurrent requests?

提交回复
热议问题