Topic
  • 3 replies
  • Latest Post - ‏2013-10-28T20:39:23Z by VRajput
mikeyatwork
mikeyatwork
2 Posts

Pinned topic Socket error when using Web Preview Server's proxy

‏2013-10-22T17:15:59Z |

We're using Eclipse Juno SR2 and WebSphere® Application Server V8.5 Tools 8.5.5000.v20130528_1930. 

I have a dojo app that is using the proxy to hit a different site but I often get a socket exception. When the error happens, typically all subsequent request will fail with the same error until I restart. The links work fine if I hit them directly without the proxy.

[ERROR   ] SRVE0777E: Exception thrown by application class 'java.net.SocketInputStream.read:140'
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.read(SocketInputStream.java:140)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:229)
at java.io.BufferedInputStream.read(BufferedInputStream.java:248)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at com.ibm.ws.ajaxproxy.servlet.ProxyServlet.service(ProxyServlet.java:655)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240)
at [internal classes]

I'm guessing the proxy is running out of available sockets (until they time out) which causes all requests to stop.

Looking at the jars for the proxy (.metadata\.plugins\com.ibm.etools.wdt.server.core\tmp0\usr\servers\defaultServer0\apps\proxy\WEB-INF\lib\commons-httpclient-3.1.jar), the version of httpclient is surprisingly old (5 years?) and is no longer supported. I thought I would be able to add a config file to modify the timeout, number of sockets etc but that doesn't seem possible. I tried to programatically change them as part of my web app but it's hard to know if my changes take affect plus they didn't seem to make a difference. 

So anyone else have a similar problem or have ideas on how to fix it? It's not critical but it is annoying & wastes our time.

  • VRajput
    VRajput
    2 Posts

    Re: Socket error when using Web Preview Server's proxy

    ‏2013-10-28T15:10:57Z  

    The "Read timed out" exception is thrown by class java.net.SocketInputStream.read which means server is trying to read data, but its taking longer than the timeout value for the data to arrive and the server just timed out waiting for the data to arrive.

    Possible reasons for this error could be:

    1. The site is returning too much data.
    2. The backend is overloaded with requests
    3. or the socket time is set to a too low value in the proxy server.

    As a solution, on server end, you can increase the socket time out by making changes to proxy-config.xml file (workspace\.metadata\.plugins\com.ibm.etools.wdt.server.core\tmp0\usr\servers\defaultServer0\apps\proxy\WEB-INF) . You can use the socket-timeout variable to define a time out value

    <proxy:meta-data>
            <proxy:name>socket-timeout</proxy:name>
            <proxy:value>60000</proxy:value>
    </proxy:meta-data>

    where 60000 ms = 60 sec

  • mikeyatwork
    mikeyatwork
    2 Posts

    Re: Socket error when using Web Preview Server's proxy

    ‏2013-10-28T16:47:36Z  
    • VRajput
    • ‏2013-10-28T15:10:57Z

    The "Read timed out" exception is thrown by class java.net.SocketInputStream.read which means server is trying to read data, but its taking longer than the timeout value for the data to arrive and the server just timed out waiting for the data to arrive.

    Possible reasons for this error could be:

    1. The site is returning too much data.
    2. The backend is overloaded with requests
    3. or the socket time is set to a too low value in the proxy server.

    As a solution, on server end, you can increase the socket time out by making changes to proxy-config.xml file (workspace\.metadata\.plugins\com.ibm.etools.wdt.server.core\tmp0\usr\servers\defaultServer0\apps\proxy\WEB-INF) . You can use the socket-timeout variable to define a time out value

    <proxy:meta-data>
            <proxy:name>socket-timeout</proxy:name>
            <proxy:value>60000</proxy:value>
    </proxy:meta-data>

    where 60000 ms = 60 sec

    Great thanks, I will give this a try.

    Are the possible options for this file documented anywhere? There are a few other things I would like to try as well (ex: increasing the # of sockets etc). Unfortunately the xsd link (xmlns:proxy="http://www.ibm.com/xmlns/prod/sw/ajax/proxy-config/1.1") is not valid.

  • VRajput
    VRajput
    2 Posts

    Re: Socket error when using Web Preview Server's proxy

    ‏2013-10-28T20:39:23Z  

    Great thanks, I will give this a try.

    Are the possible options for this file documented anywhere? There are a few other things I would like to try as well (ex: increasing the # of sockets etc). Unfortunately the xsd link (xmlns:proxy="http://www.ibm.com/xmlns/prod/sw/ajax/proxy-config/1.1") is not valid.

    you can refer to this article about proxy-confi.xml file here and I am sure you will find other useful info as well.

    http://pic.dhe.ibm.com/infocenter/rsahelp/v9/index.jsp?topic=%2Fcom.ibm.etools.webtoolscore.doc%2Ftopics%2Ftcrtajaxtestserver.html

     

    And thanks for bringing the invalid link to our attention. We will take appropriate steps to rectify it.