axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Suriarachchi <amilasuriarach...@gmail.com>
Subject Re: Axis2 WebService - Timer threads are accumuating and java.lang.OutOfMemoryError: unable to create new native thread
Date Wed, 31 Aug 2011 10:10:32 GMT
On Tue, Aug 30, 2011 at 1:04 AM, divvela <divvela1@yahoo.com> wrote:

>
> Hello,
> We have a webapplication runnig on glassfish version 2.1 connecting to a
> webservice using the piece of the code below. Every day we are having over
> 1000 calls. For some reason timer threads are getting accumalated day by
> day. Couple of days after we are getting java.lang.OutOfMemoryError: unable
> to create new native thread ... Which indicates probably some thing wrong
> with code or some bug in axis2 which i am not aware of ... Please help ...
> This is becoming a BIG BIG production issue for us. Appreciate your help in
> this matter.
>
>        public String CallWebService(String webServiceName, OMElement
> webServiceRequest) throws Exception
>        {
>                                ConfigurationContext ctx =
>
> ConfigurationContextFactory.createConfigurationContextFromFileSystem("/export/home/test",
> "/export/home/test/conf/axis2.xml");
>

try stopping creating a configuration context per invocation. Try to keep
one configuration context object.

thanks,
Amila.

>
>                                ServiceClient client = new
> ServiceClient(ctx, null);
>                                Options options = new Options();
>                                client.setTargetEPR(new
> EndpointReference("URL"));
>                                options.setTo(new EndpointReference("URL"));
>
>  options.setAction("URLACTION"+webServiceName);
>                                options.setTimeOutInMilliSeconds(90*1000);
>                                client.setOptions(options);
>
>                                client.engageModule("addressing");
>                                client.engageModule("rampart");
>
>                                OperationClient  sender =
> client.createClient(ServiceClient.ANON_OUT_IN_OP);
>                            MessageContext mc = new MessageContext();
>                            SOAPFactory fac =
> OMAbstractFactory.getSOAP11Factory();
>                            SOAPEnvelope envelope=fac.getDefaultEnvelope();
>
>                            OMNamespace vis =
> fac.createOMNamespace("URLNAMESPACE", "emp");
>                            envelope.declareNamespace(vis);
>
>                            envelope.getBody().addChild(webServiceRequest);
>                            mc.setEnvelope(envelope);
>                            sender.addMessageContext(mc);
>
>                                String webserviceReponse = "";
>                        try
>                        {
>                                sender.execute(true);
>                                MessageContext responsemsg =
> sender.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>                                        SOAPBody body =
> responsemsg.getEnvelope().getBody();
>                                        webserviceReponse = body.toString();
>
>                                    client.cleanup();
>                                    client.cleanupTransport();
>                                    client.disengageModule("addressing");
>                                    client.disengageModule("rampart");
>                                    sender.reset();
>                                }
>                                catch(AxisFault e)
>                                {
>                                        System.out.println("Exception
> is"+e);
>                                        e.printStackTrace();
>                                }
>
>                        return webserviceReponse;
>        }
>
>
> Threads accumulating below ...
>
> Thread "Timer-10" thread-id 125 thread-stateTIMED_WAITINGWaiting on lock:
> java.util.TaskQueue@c65650
>         at: java.lang.Object.wait(Native Method)
>         at: java.util.TimerThread.mainLoop(Timer.java:509)
>         at: java.util.TimerThread.run(Timer.java:462)
>
>
> Thread "Timer-9" thread-id 124 thread-stateTIMED_WAITINGWaiting on lock:
> java.util.TaskQueue@14cc383
>         at: java.lang.Object.wait(Native Method)
>         at: java.util.TimerThread.mainLoop(Timer.java:509)
>         at: java.util.TimerThread.run(Timer.java:462)
>
>
> Thread "Timer-8" thread-id 119 thread-stateTIMED_WAITINGWaiting on lock:
> java.util.TaskQueue@b7f935
>         at: java.lang.Object.wait(Native Method)
>         at: java.util.TimerThread.mainLoop(Timer.java:509)
>         at: java.util.TimerThread.run(Timer.java:462)
>
>
> Thread "Timer-7" thread-id 118 thread-stateTIMED_WAITINGWaiting on lock:
> java.util.TaskQueue@4a1861
>         at: java.lang.Object.wait(Native Method)
>         at: java.util.TimerThread.mainLoop(Timer.java:509)
>         at: java.util.TimerThread.run(Timer.java:462)
>
>
> Thread "MultiThreadedHttpConnectionManager cleanup" thread-id 115
> thread-stateWAITINGWaiting on lock:
> java.lang.ref.ReferenceQueue$Lock@86b79d
>         at: java.lang.Object.wait(Native Method)
>         at: java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
>         at: java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
>         at:
>
> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ReferenceQueueThread.run(MultiThreadedHttpConnectionManager.java:1122)
>
>
> Thread "Timer-6" thread-id 114 thread-stateTIMED_WAITINGWaiting on lock:
> java.util.TaskQueue@80a6bd
>         at: java.lang.Object.wait(Native Method)
>         at: java.util.TimerThread.mainLoop(Timer.java:509)
>         at: java.util.TimerThread.run(Timer.java:462)
>
>
> Thread "Timer-5" thread-id 113 thread-stateTIMED_WAITINGWaiting on lock:
> java.util.TaskQueue@42d711
>         at: java.lang.Object.wait(Native Method)
>         at: java.util.TimerThread.mainLoop(Timer.java:509)
>         at: java.util.TimerThread.run(Timer.java:462)
>
>
> --
> View this message in context:
> http://old.nabble.com/Axis2-WebService---Timer-threads-are-accumuating-and-java.lang.OutOfMemoryError%3A-unable-to-create-new-native-thread-tp32359532p32359532.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Mime
View raw message