• Bug
  • Status: Open
  • 2 Major
  • Resolution:
  • prodmgmt
  • Reporter: necsy
  • May 03, 2011
  • 0
  • Watchers: 3
  • May 14, 2018

Description

Hi, i’m using terracotta 3.5, with toolkit terracotta-toolkit-1.2-runtime-3.0.0.jar. From a client, i get a reference to a distribuited BlockingQueue, where i put some informations that another client uses.

If the net goes down, or if the application thinks that is no more aligned, i need to do a “shutdown” of TerracottaClient and then a new connection.

The problem is that this lead to a memory leak, and after 3/4 reconnection i get PermGen OutOfMemory error. All threads and classes are not terminated or released after the call to shutdown method of TerracottaClient.

Comments

Fiona OShea 2011-05-03

Can you please provide a reproducible test case? Can you provide JVM, Environment information?

thanks

laf nescy 2011-05-13

Hi, i forgot a “small” thing: the client terracotta is inside an applet (it’s for intranet use only). I tried to shutdown from a standard client, and it stops cleanly. But if i take the same code and i launch it from an applet, after shutdown che classes aren’t collected (unloaded) and after 5/6 reconnection applet crash. Sometimes java can collect, but once every 5/6 reconnections. To make terracotta works inside the applet, i’ve signed the applet, and also setted the SecurityManager to a custom one (that always permits) before connecting to server.

Using java 6.24, firefox 4.01.

To test, i simply call several times this snippet:

//////////////////////////////////////////// try { Thread.sleep(3000); } catch (Exception e) {

}

try { // client = new TerracottaClient(“10.1.0.34:9510”, true); System.out.println(“Connected”); client_shutdowned = false;

nodeId = client.getToolkit().getClusterInfo().getCurrentNode().getId();

cl = new ClusterListener() \{

	
	@Override
	public void operationsEnabled(ClusterEvent arg0) \{
		// TODO Auto-generated method stub
		
	\}
	
	@Override
	public void operationsDisabled(ClusterEvent arg0) \{
		// TODO Auto-generated method stub
		
	\}
	
	@Override
	public void nodeLeft(ClusterEvent arg0) \{
		System.out.println("Node disconnected from Terracotta Cluster.");
		Thread t = new Thread(new Runnable() \{
			public void run() \{
				try \{
					Thread.sleep(1000);
				\} catch (InterruptedException e) \{
					e.printStackTrace();
				\}
				queue = null;
				cl = null;
				nodeId = null;
				client.shutdown();
				client\_shutdowned = true;
				System.out.println("Disconnected automatically");		
			\}
		\});
		t.start();
		
	\}
	
	@Override
	public void nodeJoined(ClusterEvent arg0) \{
		// TODO Auto-generated method stub
		
	\}
\};

client.getToolkit().getClusterInfo().addClusterListener(cl);
queue = null;

queue = client.getToolkit().getBlockingQueue("queue/A");


try \{
	Thread.sleep(60000);
\} catch (InterruptedException e) \{
	e.printStackTrace();
\}

if (!client\_shutdowned)				
\{
	client.getToolkit().getClusterInfo().removeClusterListener(cl);
	queue = null;
	cl = null;
	nodeId = null;
	client.shutdown();				
	System.out.println("Disconnected manually");
\} \} catch (Exception e1) \{

e1.printStackTrace(); \}

Fiona OShea 2011-05-17

Review our applet strategy