I have isolated the code to do only the request that creates the memory leak. Its being done in a loop. I have upgraded to java 1.4.2_0, but the problem still exists.
Both top and ps show the process to be monotonically increasing in size. I used Optimizeit to try and isolate the leaks, but although it indicates that Strings and char[] are being leaked, it can't help isolate the culprits. Also, the size and amount of leaks indicated by OptimizeIt are miniscule compared to the number reported by top or ps.
I'd appreciate it if the experts could look at the short program that I have attached and see if ther is anything I'm doing incorrectly.
I have attached my.java - which is the program, PASSEngineConfigurationFactory.java - to use commons httpclient, o - the shell used to start the java program.



From: "Parley, Thunder Jon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
Subject: RE: need info about memory leak in axis
Date: Thu, 25 Mar 2004 09:29:37 -0800

Hi Fredo,

Maybe it is a problem with your JVM?

http://developer.java.sun.com/developer/bugParade/bugs/4724129.html

--Thunder



-----Original Message-----
From: Fredo Corleone [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 8:55 AM
To: [EMAIL PROTECTED]
Subject: need info about memory leak in axis


I'm using axis as a ws client and I get a memory leak everytime I send a
request. The requests and responses are very small (less than 500 bytes),
but the memory leak is significant. I'm using java 1.4.1 on Solaris.
I was using axis 1.2 snapshot from Jan 6 2004 that I compiled. I re-compiled
with the snapshot from March 24 2004 (last night) and have the same type of
leak.
I read the email archives and found that others had complained about memory
leaks as well, but there was no acknowledgement/resolution posted.
So, does anybody have any insight into the memory leak problem with axis?


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now!
http://toolbar.msn.com/go/onm00200415ave/direct/01/


_________________________________________________________________
Check out MSN PC Safety & Security to help ensure your PC is protected and safe. http://specials.msn.com/msn/security.asp
package com.foo.my;

import java.util.*;
import java.io.*;
import java.net.*;

import mil.army.us.peoc3t.PASS.*;
import mil.army.us.peoc3t.PASS.ports.*;
import mil.army.us.peoc3t.PASS.wsdl.*;

import org.apache.axis.*;
import org.apache.axis.client.Stub;

public class my
{
	public int topicrefreshtime=30000;
	my()
	{
	}
	public static void main(String[] args)
	{
		my m = new my();
		if(args[0] != null)
			m.topicrefreshtime = Integer.parseInt(args[0])*1000;
		m.go();
	}
	private void go()
	{
		try
		{
			System.setProperty("javax.net.ssl.trustStore",
				//"c:\\h\\pcisdk\\data\\truststore");
				"/h/PCI/data/truststore");
		}
		catch (Exception ex)
		{
			System.out.println("Exception setting javax.net.ssl.trustStore=");
				ex.printStackTrace();
		}
		try
		{
			System.setProperty("javax.net.ssl.trustStorePassword", "mitre1");
		}
		catch (Exception ex)
		{
			System.out.println(
				"Exception setting javax.net.ssl.trustStorePassword");
					ex.printStackTrace();
		}
		AxisProperties.setProperty(
			EngineConfigurationFactory.SYSTEM_PROPERTY_NAME,
			"com.foo.my.PASSEngineConfigurationFactory");

		PASSPortType m_passService = null;
		try
		{
			m_passService = new PASServiceLocator().getPASService(
				new URL("https://134.80.99.231:7778/PASS";));
			Stub stub = (Stub) m_passService;
			stub._setProperty("javax.xml.rpc.security.auth.username",
				"ajd1");
			stub._setProperty("javax.xml.rpc.security.auth.password",
				"pass1");
		}
		catch (Exception e)
		{
			System.out.println("bind failed: " + e.toString());
		}

		_sync syncReq = new _sync();
		syncReq.setCompression(false);
		syncReq.setRequester_id("ajd1");
		syncReq.setTopic("topics");
		while (true)
		{
			try
			{
				// Request stuff from the server
				_sync_response sr = m_passService.sync(syncReq);
				System.out.println("Ntopics: " + sr.getCreate_topic().length);
				sr = null;
			}
			catch(Pass_fault e)
			{
				System.out.println("sync for topics fault: " + faultString(e));
				System.out.println(e.getStatus());
			}
			catch(Exception e)
			{
				System.out.println("sync for topics failed: " + e.toString());
				e.printStackTrace();
			}

			try
			{
				System.out.println("sleeping:"+topicrefreshtime);
				Thread.currentThread().sleep(topicrefreshtime);
			}
			catch(InterruptedException e)
			{
			}
		}
	}
	private final static String faultString(Pass_fault fault)
	{
		return("\ndetails-> " +  fault.getError_details() + "\n" +
			statusString(fault.getStatus()));
	}

	private final static String statusString(Status status)
	{
		return("status code-> " + status.getStatus_code() + " status phrase-> "
			+ status.getStatus_phrase());
	}
}

set -x
export JAVA_HOME=/h/PCI/j2re1.4.2_04
export CLASSPATH=my.jar:axis.jar:commons-discovery.jar:commons-httpclient-2.0.jar:commons-logging.jar:jaxrpc.jar:log4j-1.2.8.jar:log4j.properties:saaj.jar:wsdl4j.jar
$JAVA_HOME/bin/java com.foo.my.my 5


package com.foo.my;


import org.apache.axis.message.*;
import org.apache.axis.types.*;
import org.apache.xml.serialize.*;

import org.apache.axis.client.*;
import org.apache.axis.transport.http.*;
import org.apache.axis.configuration.*;
import org.apache.axis.*;


/**
 * Configure the Axis client to use HTTP 1.1.
 */
public class PASSEngineConfigurationFactory implements 
    EngineConfigurationFactory {
        public static EngineConfigurationFactory   newFactory(java.lang.Object param) 
        {
            return new PASSEngineConfigurationFactory();
        }
        public EngineConfiguration getClientEngineConfig()
        {
            return new PASSClientConfig();
        }
        public EngineConfiguration getServerEngineConfig()
        {
            return null;
        }
    }


class PASSClientConfig extends SimpleProvider {
    public PASSClientConfig() {
        deployTransport("http", new SimpleTargetedChain(new CommonsHTTPSender()));
        deployTransport("https", new SimpleTargetedChain(new CommonsHTTPSender()));
    }
}




Reply via email to