axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Yu (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-2266) Axis Memory leak in v1.3
Date Thu, 20 Oct 2005 19:34:49 GMT
Axis Memory leak in v1.3
------------------------

         Key: AXIS-2266
         URL: http://issues.apache.org/jira/browse/AXIS-2266
     Project: Apache Axis
        Type: Bug
  Components: Basic Architecture  
 Environment: Solaris and Windows
    Reporter: Alan Yu
    Priority: Critical


We had a memory leak problem in the old axis version 1.1.  But due to the low traffic, we
didn't quite notice it. 3 weeks ago, the traffic is increased and this problem had emerged.

I did some investigation and used the Optimizeit to do profiling. I then decided to upgrade
to latest 1.3 which the release notes claims the memory leak problem is fixed.

But unfortunately, this is still there.

We use axis to send a request to do login validation on a remote web site. No stubs is generated.
The code is simple as follows:

  public InboxStorageAccessResult prepareInboxStorageAccess(
      String url, String inboxDID, long inboxServiceKey, String domain, String site)
      throws J2ContainerException, PoolExhaustedException
  {

    String[] loginParameters = null;
    try {
      SOAPConnection connection = getConnection();
      Service service = null;
      try {
        service = connection.getService();
        Call call = service.createCall();
        if (log.isDebugEnabled()) {
          log.debug("Initiating SOAP call.  Address=" + url);
        }

        call.setTargetEndpointAddress(url);
        call.setOperationName(new QName(loginUrn, "login"));
        loginParameters = new String[] {
          loginId,
          loginPassword,
          inboxDID,
          domain, // domain.
          inboxServiceKey + "",
          site
        };
        if (log.isDebugEnabled()) {
          log.debug("calling: \t" + url);
          log.debug("method: \t" + loginUrn);
          log.debug("loginId= " + loginId +
                    "; loginPassword=" + loginPassword +
                    "; inboxDID = " + inboxDID +
                    "; domain =" + domain +
                    "; inboxServiceKey = " + inboxServiceKey);
        }
        String soapResult = ((String) call.invoke(loginParameters));
        return new InboxStorageAccessResult(soapResult);
      } finally {
        try {
          connection.cleanup(service);
        } catch (ConfigurationException e) {
          log.error("ConfigurationException: loginParameters: " + StringUtil.joinWithCommas(loginParameters),
e);
          throw new TwaRemoteException("Call to electric mail login failed", e);
        }
        returnConnection(connection);
      }

    } catch (ServiceException ex) {
      log.error("ServiceException: loginParameters: " + StringUtil.joinWithCommas(loginParameters),
ex);
      throw new TwaRemoteException("Call to electric mail login failed", ex);
    } catch (RemoteException ex) {
      log.error("RemoteException: loginParameters: " + StringUtil.joinWithCommas(loginParameters),
ex);
      throw new TwaRemoteException("Call to electric mail login failed", ex);
    }
  }

The leak are at char[], int[], String and java.util.Hashtable. The attached profiler snapshot
is a trace for leak from Hashtable.

I tried to add a few cleanup method like below

    public void cleanup(Service service) throws AxisFault,
        ConfigurationException {
      log.debug("[in] axisCleanup");
      if ( service == null ) {
        log.debug("service null");
        return;
      }

      AxisEngine ae = service.getEngine();
      if ( ae == null ) {
        log.debug("axisEngine is null");
        return;
      }
      
      MessageContext mc = ae.getCurrentMessageContext();
      if (mc != null &&
          mc.getRequestMessage() != null &&
          mc.getRequestMessage().getSOAPEnvelope() != null)
      {
        log.debug("****** clean envelope ******");
        mc.getRequestMessage().getSOAPEnvelope().removeBody();
        mc.getRequestMessage().getSOAPEnvelope().removeContents();
        mc.getRequestMessage().getSOAPEnvelope().removeHeaders();
        if ( mc.getRequestMessage().getSOAPEnvelope().getRecorder() != null) {
          log.debug("****** clean recorder ******");
          mc.getRequestMessage().getSOAPEnvelope().getRecorder().clear();
        }
      } else {
        log.debug("no envelope is available");
      }
      ae.cleanup();
      if (ae.getGlobalRequest() != null) {
        ae.getGlobalRequest().cleanup();
      }
      if (ae.getGlobalResponse() != null) {
        ae.getGlobalResponse().cleanup();
      }
    }

but it doesn't help.  The envelope part is null and I got "no envelope is available" from
my debug printout.

Because of this memory leak, we have to restart our web server once a day.

I'd appreciate it if you can provide any solution to fix the problem.

Thanks,
-Alan

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message