You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org> on 2009/05/06 07:01:30 UTC

[jira] Commented: (AXIS2-4330) axis2 client machine has many CLOSE_WAIT tcp

    [ https://issues.apache.org/jira/browse/AXIS2-4330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12706303#action_12706303 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-4330:
-----------------------------------------------------

Please look at the this thread I started regarding this issue[1].

If you service invocation happens using one thread you can switch on the keep alive as I have mentioned there. Other wise you need to stop the connection manger per each request as given below.

if you can provide a sample client code we can help you to fix the problem.

[1] http://marc.info/?l=axis-dev&m=124132458701826&w=2

sample client code.
--------------------------------------------------------------------------------------------------------------------------------------
MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
        HttpConnectionManagerParams params = new HttpConnectionManagerParams();
        HostConfiguration hostConfiguration = new HostConfiguration();
        hostConfiguration.setHost("localhost", 8085);
        params.setMaxTotalConnections(100);
        params.setMaxConnectionsPerHost(hostConfiguration, 25);
        httpConnectionManager.setParams(params);

        HttpClient httpClient = new HttpClient(httpConnectionManager);

        try {

            client = new ServiceClient(null, null);
            Options opts = new Options();
            client.setOptions(opts);
            opts.setTo(new EndpointReference("http://localhost:8085/axis2/services/TestInOutService"));
            opts.setAction("urn:TestInOutService");

            OMElement payload = buildSoapObject(
                    "<ns1:getPrice xmlns:ns1=\"http://quickstart.samples/xsd\">" +
                            "<ns1:symbol>IBM</ns1:symbol>" +
                            "</ns1:getPrice>"
            );
            System.out.println("Sending the request ...." + System.currentTimeMillis());

            client.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);
            client.getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
            OMElement response = client.sendReceive(payload);
            response.build();

        } catch (Exception e) {
            e.printStackTrace();
        }
        finally {
            if (client != null) {
                try {
                    client.cleanupTransport();
                } catch (Exception e) {
                    e.printStackTrace();
                }

                try {
                    client.cleanup();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

        }
        try {
            Thread.sleep(1000);
        } catch (Exception e) {// do nothing}
        }
        httpConnectionManager.closeIdleConnections(0);
        httpConnectionManager.shutdown();


    }

> axis2  client machine has many CLOSE_WAIT tcp
> ---------------------------------------------
>
>                 Key: AXIS2-4330
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4330
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>         Environment: solaris
>            Reporter: yanni tan
>
> My application is using axis2 web service. It  invokes web service thousand times per second. We observed thousand CLOSE_WAIT connection after the application is run for less than 10 hours.  I checked even I set REUSE_HTTP_CLIENT to false, it still gets CLOSE_WAIT.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.