RE: ServiceClient and memory leaks
Thanks Amila, I used the Axis2-1.4.1 and the memory leak issue is resolved. Thanks, Asmita From: Amila Suriarachchi [mailto:amilasuriarach...@gmail.com] Sent: Monday, February 09, 2009 11:57 PM To: axis-user@ws.apache.org Subject: Re: ServiceClient and memory leaks On Tue, Feb 10, 2009 at 6:00 AM, Attharkar, Asmita mailto:aatth...@telcordia.com>> wrote: We are calling a web service client in the web service and see that there are huge memory leaks - finally resulting in OutOfMemoryException. We are deploying it on Jboss (jboss-4.0.3SP1). I do a serviceClient.cleanup() in the finally block after receiving the response but that doesnt help either. This seems to be existing issue in Axis2-1.4. If yes, what is the workaround for the cleanup. I am not using the generated stub instead I have my own code that calls ServiceClient code. Please have a look at with the Axis2 1.4.1. this should have been fixed. The problem was not removing the endpoint references from the axis configuration. thanks, Amila. Please treat this as urgent as the application is getting terminated because of outOfMemory error. Thanks! Thanks, Asmita (Tel) 732-699-4657 | 4B566 | Telcordia Technologies | Piscataway NJ 08854 -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/
Re: ServiceClient and memory leaks
On Tue, Feb 10, 2009 at 6:00 AM, Attharkar, Asmita wrote: > We are calling a web service client in the web service and see that there > are huge memory leaks - finally resulting in OutOfMemoryException. We are > deploying it on Jboss (jboss-4.0.3SP1). > > I do a serviceClient.cleanup() in the finally block after receiving the > response but that doesnt help either. This seems to be existing issue in > Axis2-1.4. If yes, what is the workaround for the cleanup. I am not using > the generated stub instead I have my own code that calls ServiceClient code. > Please have a look at with the Axis2 1.4.1. this should have been fixed. The problem was not removing the endpoint references from the axis configuration. thanks, Amila. > > > Please treat this as urgent as the application is getting terminated > because of outOfMemory error. > > > > Thanks! > > > > > > Thanks, > > Asmita > > > > > -- > > (Tel) 732-699-4657 | 4B566 | Telcordia Technologies | Piscataway NJ 08854 > > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/
Re: ServiceClient and memory leaks
Yes this is the problem, you should not do like this. Do the following and let me know the outcome - First create a ConfigurationContext (refer to following articles) - Then use that to create service client http://today.java.net/pub/a/today/2006/12/13/invoking-web-services-using-apache-axis2.html Thank you! Deepal Attharkar, Asmita wrote: > Hello Deepal, > > Here is my client code. A new ServiceClient is created everytime for all the > invocations: > > ServiceClient sender = new ServiceClient(); > try { > > > if (!isInitDone) > init(); > > _logger.info("Time taken to create call = " + > (System.currentTimeMillis() - sendMsgBeginTime)); > _logger.info("before invoke"); > long invokeBeginTime = System.currentTimeMillis(); > > > > > Options options = new Options(); > > options.setTo(new EndpointReference(soapServiceLocation)); > > options.setAction("urn:processNPCMsg"); > > > options.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE); > > options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); > options.setTransportInProtocol(Constants.TRANSPORT_HTTP); > > sender.setOptions(options); > > OMElement response = > sender.sendReceive(createPayLoad(userId,password,xmlMsg,dataHandlers)); > System.out.println(response); > > long invokeTime = System.currentTimeMillis() - invokeBeginTime; > _logger.info("after invoke time taken = " + invokeTime); > > if (response == null) { > _logger.error("Cannot talk to the remote soap service, " + > " most likely a configuration problem"); > throw new Exception("Cannot talk to the remote soap service, " + > " most likely a configuration problem"); > } > _logger.info("-- "+response.getFirstElement().getText()); > return response.getFirstElement().getText(); > > } catch (Exception ex) { > System.out.println("Unknown exception :::" + ex.toString()); > throw ex; > } finally > { > sender.cleanup(); > } > > > -Original Message- > From: Deepal Jayasinghe [mailto:dee...@opensource.lk] > Sent: Monday, February 09, 2009 7:39 PM > To: axis-user@ws.apache.org > Subject: Re: ServiceClient and memory leaks > > How do you invoke the service, do you create service client for each > call or you just create one service client and use that for all the > invocations. > > Deepal > > Attharkar, Asmita wrote: > >> We are calling a web service client in the web service and see that >> there are huge memory leaks - finally resulting in >> OutOfMemoryException. We are deploying it on Jboss (jboss-4.0.3SP1). >> >> I do a serviceClient.cleanup() in the finally block after receiving >> the response but that doesnt help either. This seems to be existing >> issue in Axis2-1.4. If yes, what is the workaround for the cleanup. I >> am not using the generated stub instead I have my own code that calls >> ServiceClient code. >> >> >> >> Please treat this as urgent as the application is getting terminated >> because of outOfMemory error. >> >> >> >> Thanks! >> >> >> >> >> >> Thanks, >> >> Asmita >> >> >> >> >> >> >> >> (Tel) 732-699-4657 | 4B566 | Telcordia Technologies | Piscataway NJ >> 08854 >> >> >> >> > > -- > Thank you! > > > http://blogs.deepal.org > http://deepal.org > > > -- Thank you! http://blogs.deepal.org http://deepal.org
RE: ServiceClient and memory leaks
Hello Deepal, Here is my client code. A new ServiceClient is created everytime for all the invocations: ServiceClient sender = new ServiceClient(); try { if (!isInitDone) init(); _logger.info("Time taken to create call = " + (System.currentTimeMillis() - sendMsgBeginTime)); _logger.info("before invoke"); long invokeBeginTime = System.currentTimeMillis(); Options options = new Options(); options.setTo(new EndpointReference(soapServiceLocation)); options.setAction("urn:processNPCMsg"); options.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE); options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); sender.setOptions(options); OMElement response = sender.sendReceive(createPayLoad(userId,password,xmlMsg,dataHandlers)); System.out.println(response); long invokeTime = System.currentTimeMillis() - invokeBeginTime; _logger.info("after invoke time taken = " + invokeTime); if (response == null) { _logger.error("Cannot talk to the remote soap service, " + " most likely a configuration problem"); throw new Exception("Cannot talk to the remote soap service, " + " most likely a configuration problem"); } _logger.info("-- "+response.getFirstElement().getText()); return response.getFirstElement().getText(); } catch (Exception ex) { System.out.println("Unknown exception :::" + ex.toString()); throw ex; } finally { sender.cleanup(); } -Original Message- From: Deepal Jayasinghe [mailto:dee...@opensource.lk] Sent: Monday, February 09, 2009 7:39 PM To: axis-user@ws.apache.org Subject: Re: ServiceClient and memory leaks How do you invoke the service, do you create service client for each call or you just create one service client and use that for all the invocations. Deepal Attharkar, Asmita wrote: > > We are calling a web service client in the web service and see that > there are huge memory leaks - finally resulting in > OutOfMemoryException. We are deploying it on Jboss (jboss-4.0.3SP1). > > I do a serviceClient.cleanup() in the finally block after receiving > the response but that doesnt help either. This seems to be existing > issue in Axis2-1.4. If yes, what is the workaround for the cleanup. I > am not using the generated stub instead I have my own code that calls > ServiceClient code. > > > > Please treat this as urgent as the application is getting terminated > because of outOfMemory error. > > > > Thanks! > > > > > > Thanks, > > Asmita > > > > > > > > (Tel) 732-699-4657 | 4B566 | Telcordia Technologies | Piscataway NJ > 08854 > > > -- Thank you! http://blogs.deepal.org http://deepal.org
Re: ServiceClient and memory leaks
How do you invoke the service, do you create service client for each call or you just create one service client and use that for all the invocations. Deepal Attharkar, Asmita wrote: > > We are calling a web service client in the web service and see that > there are huge memory leaks - finally resulting in > OutOfMemoryException. We are deploying it on Jboss (jboss-4.0.3SP1). > > I do a serviceClient.cleanup() in the finally block after receiving > the response but that doesnt help either. This seems to be existing > issue in Axis2-1.4. If yes, what is the workaround for the cleanup. I > am not using the generated stub instead I have my own code that calls > ServiceClient code. > > > > Please treat this as urgent as the application is getting terminated > because of outOfMemory error. > > > > Thanks! > > > > > > Thanks, > > Asmita > > > > > > > > (Tel) 732-699-4657 | 4B566 | Telcordia Technologies | Piscataway NJ > 08854 > > > -- Thank you! http://blogs.deepal.org http://deepal.org