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.
You saved my life..
ReplyDeleteThanks! Works great.
ReplyDeleteHi Sezin!
ReplyDeleteIt 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();
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!
Deletehappy to hear that your problem is solved.
Delete