Monday, February 7, 2011

thank you axis2 for this handful of close_wait

In one of our projects we are using axis2 1.4 for generating the client side of the web service. Our web service part is working for few hours but gets stuck for no apparent reason. After I investigate a little I saw that it generates lots of sockets with CLOSE_WAIT state which results this freeze. I google a bit about similar problems with Axis2 and saw that this a known bug. Here's the source I used for fixing it. As explicitly calling the garbage collector didn't seem like a good solution, and as I can't upgrade axis2, I opt for changing the HTTP version to 1.0. For this I set a single field in the ServiceStub by calling


serviceStub._getServiceClient().getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION,
org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10)


from ServiceStub where this object is created.
After that, this CLOSE_WAIT bug is fixed.

5 comments:

  1. Hi Sezin!

    It did not work in my case. Also, none of the below statements could fix the problem.

    stub._getServiceClient().cleanup();
    stub._getServiceClient().cleanupTransport();
    stub.cleanup();
    mtHttpConnMngr.closeIdleConnections(0);
    mtHttpConnMngr.shutdown();
    mtHttpConnMngr.deleteClosedConnections();
    context.cleanupContexts();
    context.flush();
    context.terminate();

    ReplyDelete
    Replies
    1. Apologies, actually I was not setting the HTTP_PROTOCOL_VERSION at the right place. It worked after i have put it at the right place in the code. Thank u very much!

      Delete
    2. happy to hear that your problem is solved.

      Delete