cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bharath Ganesh" <>
Subject Re: Some Memory Leaks : (Registry, Threadlocal not cleared)
Date Tue, 13 Mar 2007 10:46:19 GMT
Hi Willem,

I understand the ThreadLocal will be cleared when the servicing thread dies or when setMessageContext
is called again. 
But since the servicing thread here is a Web Worker thread, the thread is pooled and stays
alive as long as the web server is alive. 
So, if there are 100 worker threads, assume each of them had serviced a web service request,
each of them would hold a MessageContext, which would inturn hold a reference to the SOAPMessageImpl
(in turn to the CXFBus->All ServerImpl's)  for the entire lifetime of server. 
Which means this needs to be fixed:-)

Anyways I have logged a bug:

For the ServerRegistry leak:


  ----- Original Message ----- 
  From: Willem Jiang 
  Cc: Deepak 
  Sent: Tuesday, March 13, 2007 3:14 PM
  Subject: Re: Some Memory Leaks : (Registry, Threadlocal not cleared)

  Hi Bharath,

  Thank you for the code review.

  The ServerRegistry just work for calling the endpointImpl's shutdown 
  method when the CXFBus.shutdown is called, and ServerRegistry also 
  provids the Service list info for management.
  I agree you to call the ServerRegistry's unregister method when the 
  endpointImpl's shutdown is called to avoid the ServerRegistry's memory leak.

  I don't think the ThreadLocal variable will case the memory leaks. 
  Because it is a static variable and this variable will be set by calling 
  the WebserviceContextImpl's setMessageContext method.
  The context will be GC if the thread is destoried or setMessageContext 
  is called again.


  Bharath Ganesh wrote:

  >I could see that when an endpoint is published, the corresponding org.apache.cxf.endpoint.ServerImpl
instance is registered with the ServerRegistry. I wanted to know the reason for this. As far
as I could not see there are no accessors for this registry. 
  >During endpoint.stop(), the ServerImpl is not cleared from the Registry. This leads
to strong reference of the ServerImpl, which would in-turn hold a reference to JaxWsEndpointImpl,
the observer and all related stuff. 
  >Also, even after stopping the endpoint (endpoint.stop() ) , if I get the list of services
(cxf/services) it still dispalys the serivce. (It cant be accessed since there wont be any
  >Another memory leak that I could see is in the ThreadLocal in WebserviceContextImpl.
During web service invocation, the context threadlocal is set but never cleared. I think the
threadlocal should be cleared at the end of invoke() method in JaxWsMethodInvoker. 
  >Please clarify. 
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message