Forum Discussion

gg38660's avatar
gg38660
New Contributor
15 years ago

Read timed out raises CLOSE_WAIT socket

Each time loadtestrunner throws a SocketTimeoutException exception during a read, i found that the socket seem to be not properly closed. The socket stays in CLOSE_WAIT state on the server side.
I'm currently using SoapUI 3.6.1

My question is : does soapui close properly the socket in SocketTimeOutException case ? may be in WsdlTestCaseRunner.runTestStep or WsdlTestRequestStep.run functions ?

2010-12-23 17:06:20,609 ERROR [WsdlSubmit] Exception in request: java.net.SocketTimeoutException: Read timed out
2010-12-23 17:06:20,609 ERROR [errorlog] java.net.SocketTimeoutException: Read timed out
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
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 com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(SoapUIMultiThreadedHttpConnectionManager.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at com.eviware.soapui.impl.wsdl.submit.transports.http.support.methods.ExtendedPostMethod.readResponse(ExtendedPostMethod.java:80)
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 com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:202)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.submitRequest(WsdlSubmit.java:76)
at com.eviware.soapui.impl.wsdl.WsdlRequest.submit(WsdlRequest.java:236)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.run(WsdlTestRequestStep.java:324)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runTestStep(WsdlTestCaseRunner.java:207)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runTestStepByName(WsdlTestCaseRunner.java:190)[/b]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at Script1.run(Script1.groovy:50)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runTestStep(WsdlTestCaseRunner.java:207)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:138)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:39)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:77)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:599)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:554)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:379)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:144)
at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:82)
at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:113)

1 Reply

  • gg38660's avatar
    gg38660
    New Contributor
    I have a suggestion :

    in HttpClientRequestTransport.sendRequest() function
    i saw in finally bloc code :

    if( httpMethod != null )
    {
    httpMethod.releaseConnection();
    }


    a look at releasConnection code let's me think that the first call only close responseStream but not close the socket.
    the only method to ensure that the connection is closed is to call the private ensureConnectionRelease function.

    A very simple work around is to call twice httpMethod.releaseConnection() in the finaly bloc code => the first call close the responseStream and the second call close responseConnection.

    It's look like a bug in apache HttpMethodBase class isn't it?


    public void releaseConnection() {
    1315
    1316 if (responseStream != null) {
    1317 try {
    1318 // FYI - this may indirectly invoke responseBodyConsumed.
    1319 responseStream.close();
    1320 } catch (IOException e) {
    1321 // the connection may not have been released, let's make sure
    1322 ensureConnectionRelease();
    1323 }
    1324 } else {
    1325 // Make sure the connection has been released. If the response
    1326 // stream has not been set, this is the only way to release the
    1327 // connection.
    1328 ensureConnectionRelease();
    1329 }
    1330 }



    private void ensureConnectionRelease() {
    2771 if (responseConnection != null) {
    2772 responseConnection.releaseConnection();
    2773 responseConnection = null;
    2774 }
    2775 }