ws-kandula-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wenbing Zhao <middleware_resea...@yahoo.com>
Subject Re: memory leakage?
Date Thu, 27 Jul 2006 02:28:08 GMT
I hit exactly the same problem. There is definitely very serious memory leaks. 
I did some investigation and found one problem so far. The CallbackRegistry does not
really remove its entries when they are timed out because of a bug in CallbackRegistry.java:

    timer.schedule(new TimerTask() {
            public void run() {
                callbacks.remove(callback); //<== should be callbacks.remove(callback.getID());
                try {
                    callback.timeout();
                } catch (TimedOutException e) {
                    e.printStackTrace();
                }
            }
        }, timeout);

Also, no one seems to call the remove() method in the CallbackRegistry class.

Unfortunately, the memory still leaks very rapidly with this change. I instrumented
ATCoordinatorImpl.java to see if it is ever garbage collected (by adding a finalize()
method). As I had expected, it is never garbage collected. Some other object
(probably some singleton object) must be holding a reference to all the
ATCoordinatorImpl objects being created.

I truely hope the development team can pay attention to this problem.
The memory leak problem kills any hope to use this nice software package 
seriously.

I am using kandula_1 (latest code) with Apache axis and tomcat 5.

Wenbing Zhao

----- Original Message ----
From: sergio salvi <nanorisentito@yahoo.it>
To: kandula-dev@ws.apache.org
Sent: Tuesday, July 25, 2006 4:45:17 AM
Subject: Re: memory leakage?

Here's the exception that can be read on the tomcat log file:
   
  [ATCoordinatorImpl] timeout ACTIVErg.apache.kandula.coordinator.TimedOutException at org.apache.kandula.coordinator.at.ATCoordinatorImpl.timeout(ATCoordinatorImpl.java:626)
at org.apache.kandula.coordinator.CallbackRegistry$.run(CallbackRegistry.java:62)at java.util.TimerThread.mainLoop(Timer.java:52)
  at java.util.TimerThread.run(Timer.java:462)
   
   
  and then:
   
    Exception in thread "Thread-850" java.lang.OutOfMemoryError: Java heap space
   
   
   
  and then
   
   
   
   
   
    [CallbackRegistry]  registerCallback: timeout= 80000
  AxisFault
  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
  faultSubcode: 
  faultString: java.lang.OutOfMemoryError: Java heap space; nested exception is: 
  java.lang.OutOfMemoryError: Java heap space
  faultActor: 
  faultNode: 
  faultDetail: 
  {http://xml.apache.org/axis/}hostname:valerio_sony
  and this is what I get from the client:
    AxisFault
  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
  faultSubcode: 
  faultString: java.net.SocketTimeoutException: Read timed  out
  faultActor: 
  faultNode: 
  faultDetail: 
  {http://xml.apache.org/axis/}stackTrace:java.net.SocketTimeoutException: Read timed out
  at java.net.SocketInputStream.socketRead0(Native Method)
  at java.net.SocketInputStream.read(SocketInputStream.java:29)
  at java.io.BufferedInputStream.fill(BufferedInputStream.java:83)
  at java.io.BufferedInputStream.read(BufferedInputStream.java:20)
  at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPSender.java:583)
  at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:43)
  at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
  at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:8)
  at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
  at  org.apache.axis.client.AxisClient.invoke(AxisClient.java:65)
  at org.apache.axis.client.
   
   
  I think that after the server saturates his memory it cannot istanziate new transactions.
  

Dasarath Weeratunge <dweeratu@purdue.edu> ha scritto: 
  Quoting sergio salvi :

> The client is programmned to invoke the service 1000 times, but after 120
> times it gets a timeout exception. honestly, I don't know how to call the gc

What is the timeout exception that you get? Could you please post the
details.

> in the middle. Can you tell me if you know?

System.gc() but be mindful of in which VM you make the call.

Please post your mails to kandula-dev so that they may be  archived.

thanks,
--dasarath




> thanks
> sergio
> 
> Dasarath Weeratunge ha scritto: 
> Quoting Valerio Vianello :
> 
> Is it 120 iterations or 1000? Can you try calling the gc in the middle? Also
> 
> try running it at a slower pace and see whether that makes any difference.
> 
> thanks,
> --dasarath
> 
> 
> > Hi,
> > But how mush is it the coordinator footprint? I mean, how much memory does
> 
> > it take?
> > It sounds quite strange that only 120 coordinators can cause an out of 
> > memory. Isn't it?
> > Thanks,
> > Valerio
> > 
> > ----- Original Message ----- 
> > From: "Dasarath Weeratunge" 
> > To: 
> > Sent: Sunday, July 23, 2006 4:44 PM
> > Subject: Re: memory leakage?
> > 
> > 
> > >  Quoting sergio salvi :
> > >
> > > Each time you invoke service A, it creates a new transaction. This means
> a
> > 
> > > new
> > > coordinator gets created. Once created, a coordinator object is kept 
> > > around
> > > until it timeouts (the default value is 180 s). This was done so to 
> > > respond to
> > > some late messages appropriately. We could certainly come up with a more
> > > efficient way to do this. Thus, if you create many activities within a 
> > > short
> > > duration, even if activities end in succession, it may cause their 
> > > coordinators
> > > to get accumulated. It may be this that is causing the slow down.
> > >
> > > thanks,
> > > --dasarath
> > >
> > >
> > >> I've done a client which invokes a service  A whinch in turn create a
> > >> transaction with 2 services, B and C.
> > >> The client invokes 1000 times the service A.
> > >> here is the code of the service A, the one who creates the transaction:
> > >>
> > >> public class CoordinatoreKandula {
> > >>
> > >> private Integer risultato;
> > >> private Integer ris1;
> > >> private Integer ris2;
> > >> static Logger logger;
> > >> static Logger logger2;
> > >>
> > >> /** Creates a new instance of CoordinatoreKandula */
> > >> public CoordinatoreKandula() {
> > >> risultato = null;
> > >> ris1 = null;
> > >> ris2 = null;
> > >> logger2 = Logger.getLogger("Valerio");
> > >> logger = Logger.getLogger("CoordinatoreKandula");
> >  >> PropertyConfigurator.configure("C:/Programmi/Apache Software
> > >> Foundation/Tomcat 5.5/webapps/axis/WEB-INF/classes/log4j.properties");
> > >> logger2.info("creato CoordinatoreKandula");
> > >> }
> > >> public int risolviEspressione(int tipo, int a, int b, int c, int d)
> > 
> > >> {
> > >>
> > >>
> > >> TransactionManagerImpl wstm = 
> > >> TransactionManagerImpl.getInstance();
> > >>
> > >> String endpointSomma = new
> > >> String("http://localhost:8080/axis/services/ServizioSomma");
> > >> String endpointProdotto = new
> > >> String("http://localhost:8080/axis/services/ServizioProdotto");
> > >>
> > >> //espressione tipo 1 ==> (a + b) * (c + d)
> > >> if (tipo==1) {
> > >>
>  > >> int risTipo1;
> > >>
> > >> logger.info("Operazione richiesta : (" + a + " + " + b + ") *
> > 
> > >> ("
> > >> + c + " + " + d + ")");
> > >>
> > >> try {
> > >> wstm.begin();
> > >> }catch(RemoteException e) {
> > >> logger.info("Errore nel begin ");
> > >> e.printStackTrace();
> > >> }
> > >>
> > >> Service service = new Service();
> > >> Call call = null;
> > >>
> > >> try {
> > >> call = (Call) service.createCall();
> > >> }catch(javax.xml.rpc.ServiceException e) {
> > >> logger.info("Errore nel creare oggetto call");
> > >> }
> > >>
> > >> //call per (a + b)
> > >>  call.setTargetEndpointAddress(endpointSomma);
> > >> call.setOperationName("somma");
> > >> call.setUseSOAPAction(true);
> > >>
> > >> call.setSOAPActionURI
> > > ("http://localhost:8080/axis/services/kandulaServizioSomma#somma");
> > >>
> > >> call.addParameter( "op1", XMLType.XSD_INT, ParameterMode.IN);
> > >> call.addParameter( "op2", XMLType.XSD_INT, ParameterMode.IN);
> > >> call.setReturnType( XMLType.XSD_INT );
> > >> Integer op1 = new Integer(a);
> > >> Integer op2 = new Integer(b);
> > >>
> > >>
> > >> try {
> > >> ris1 = (Integer) call.invoke( new Object [] {op1,op2});
> > >> }catch(java.rmi.RemoteException e) {
> > >> System.err.println("catch CoordinatoreKandulaInvoke1-> 
> > >> " +
> >  >> e);
> > >> e.printStackTrace();
> > >> }
> > >>
> > >> //call2 per (c+d)
> > >> Call call2 = null;
> > >>
> > >> try {
> > >> call2 = (Call) service.createCall();
> > >> }catch(javax.xml.rpc.ServiceException e) {
> > >> logger.info("Errore nel creare oggetto call2");
> > >> }
> > >>
> > >> call2.setTargetEndpointAddress(endpointSomma);
> > >> call2.setOperationName("somma");
> > >> call2.setUseSOAPAction(true);
> > >>
> > >> call2.setSOAPActionURI
> > > ("http://localhost:8080/axis/services/kandulaServizioSomma#somma");
> > >>
> > >> call2.addParameter( "op3", XMLType.XSD_INT, 
> > >> ParameterMode.IN);
> > >> call2.addParameter( "op4",  XMLType.XSD_INT, 
> > >> ParameterMode.IN);
> > >> call2.setReturnType( XMLType.XSD_INT );
> > >> Integer op3 = new Integer(c);
> > >> Integer op4 = new Integer(d);
> > >>
> > >> try {
> > >> ris2 = (Integer) call2.invoke( new Object [] {op3,op4});
> > >>
> > >> }catch(java.rmi.RemoteException e) {
> > >> System.err.println("catch CoordinatoreKandulaInvoke2-> 
> > >> " +
> > >> e);
> > >> e.printStackTrace();
> > >> }
> > >>
> > >> //call3 per (a + b) * (c + d)
> > >> Call call3 = null;
> > >>
> > >> try {
> > >> call3 = (Call) service.createCall();
> > >> }catch(javax.xml.rpc.ServiceException e) {
> > >> logger.info("Errore nel creare oggetto  call3");
> > >> }
> > >>
> > >> call3.setTargetEndpointAddress(endpointProdotto);
> > >> call3.setOperationName("prodotto");
> > >> call3.setUseSOAPAction(true);
> > >>
> > >> call3.setSOAPActionURI
> > >
> ("http://localhost:8080/axis/services/kandulaServizioProdotto#prodotto");
> > >>
> > >> call3.addParameter( "ris1", XMLType.XSD_INT, 
> > >> ParameterMode.IN);
> > >> call3.addParameter( "ris2", XMLType.XSD_INT, 
> > >> ParameterMode.IN);
> > >> call3.setReturnType( XMLType.XSD_INT );
> > >> try {
> > >> risultato = (Integer) call3.invoke( new Object []
> > >> {ris1,ris2});
> > >>
> > >> }catch(java.rmi.RemoteException e) {
> > >> System.err.println("catch  CoordinatoreKandulaInvoke3-> 
> > >> " +
> > >> e);
> > >> e.printStackTrace();
> > >> }
> > >>
> > >>
> > >> try {
> > >> wstm.commit();
> > >>
> > >> }catch(RemoteException e) {
> > >> logger.info("Errore nel commit ");
> > >> e.printStackTrace();
> > >> }
> > >>
> > >> logger.info("(" + a + " + " + b + ") * (" + c + " + " + d + 
> > >> ") =
> > >> " + risultato.intValue());
> > >> }
> > >>
> > >> else logger.info("input sbagliato");
> > >>
> > >> return risultato.intValue();
> > >> }
> > >> }
> > >>
> > >>
> > >> Dasarath Weeratunge ha scritto:
> > >>  Quoting sergio salvi :
> > >>
> > >> are you creating a new transaction each time? if you could please post

> > >> your
> > >> client code so that we can get a better idea about what your client is
> > >> doing.
> > >>
> > >> thanks,
> > >> --dasarath
> > >>
> > >>
> > >>
> > >>
> > >> Chiacchiera con i tuoi amici in tempo reale!
> > >> http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: kandula-dev-help@ws.apache.org
> > > 
> > 
> > Chiacchiera con i tuoi  amici in tempo reale! 
> > http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: kandula-dev-help@ws.apache.org
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: kandula-dev-help@ws.apache.org
> 
> 
> 
> Chiacchiera con i tuoi amici in tempo reale! 
> http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail:  kandula-dev-help@ws.apache.org


 Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com




Mime
View raw message