--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.
}
}
}
Hello Fuad,
So I try with trunk and the above program still have leak. It seems that calling hazelcast shutdown() and removing reference to it do not free associated memory. If there is something more to do to get memory back, please tell me.
In fact, this program leak memory with ou without using multicast, so it’s not the use case we have in our software.
I’m going to investigate more on our software to find out what cause our memory leak. I will give you update on this as soon as possible.
François
De : haze...@googlegroups.com [mailto:haze...@googlegroups.com]
De la part de Fuad Malikov
Envoyé : jeudi 26 janvier 2012 19:23
À : haze...@googlegroups.com
Objet : Re: Memory leak in 1.9.4.6 using multicast
Hello Fuad,
I’m back after some day spent to produce the same leak as we have in your software. Here is the new version of the program.
The thing is that the leak seems very small and slow, and I didn’t find a way to maximize or speed up it. The new version is starting a new process inside a loop and wait for it to stop. So it has only one HazelCast instance / process. The new process do some job with a HazelCast map and queue and exit. The size of the queue and the map remain constant during the test.
When I launch this program with a small heap size (10MB), the program can do a litle more than 40 iterations before I get the java.lang.OutOfMemoryError: Java heap space. If I turn multicast off, it can run more than 1000 iterations…
I try this program with Hazelcast beta 2 after changing the itemlistener, but it failed randomly with OutOfMemory or joining fails…
Hope it will help.
import java.io.File;
import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.Map;
import com.hazelcast.config.Config;
import com.hazelcast.config.Join;
import com.hazelcast.config.MulticastConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.core.IQueue;
import com.hazelcast.core.ItemListener;
import com.hazelcast.core.MembershipEvent;
import com.hazelcast.core.MembershipListener;
public class TestMemLeak implements MembershipListener, ItemListener<String>
{
static IQueue<String> tqueue = null;
public TestMemLeak()
{
// TODO Auto-generated constructor stub
}
public void memberAdded(MembershipEvent evt)
{
System.out.println(">" + evt.getMember());
}
public void memberRemoved(MembershipEvent evt)
{
System.out.println("<" + evt.getMember());
}
@Override
public void itemAdded(String arg0)
{
tqueue.poll();
}
@Override
public void itemRemoved(String arg0)
{
// TODO Auto-generated method stub
}
public static void main(String[] args)
{
System.setProperty("hazelcast.logging.type", "none");
boolean multicast = true;
boolean client = false;
String member = null;
for (String s : args)
{
if (s.equals("-nomulticast"))
multicast = false;
else if (s.equals("-client"))
client = true;
else
member = s;
}
Config hzConfig = new Config();
hzConfig.setProperty("hazelcast.shutdownhook.enabled", "false");
hzConfig.getGroupConfig().setName("testmemleak");
hzConfig.getGroupConfig().setPassword("testmemleak");
hzConfig.setProperty("hazelcast.version.check.enabled", "false");
Join join = hzConfig.getNetworkConfig().getJoin();
// set Multicast support
MulticastConfig multicastConfig = join.getMulticastConfig();
multicastConfig.setEnabled(multicast);
join.getTcpIpConfig().setEnabled(true);
if (client && !multicast && member != null)
join.getTcpIpConfig().addMember(member);
TestMemLeak testMemLeak = new TestMemLeak();
HazelcastInstance hzInstance = Hazelcast.newHazelcastInstance(hzConfig);
InetSocketAddress isa = hzInstance.getCluster().getLocalMember().getInetSocketAddress();
String lmember = isa.getAddress().getHostAddress() + ":" + isa.getPort();
tqueue = hzInstance.getQueue("testmemleak-queue");
tqueue.addItemListener(testMemLeak, true);
if (client)
doSomeWorkAndExit(hzInstance, testMemLeak);
hzInstance.getCluster().addMembershipListener(testMemLeak);
IMap<String, String> tmap = hzInstance.getMap("testmemleak-map");
tmap.put("key", "value");
for (int i=0 ;i<500; i++)
tmap.put("key"+i, "value"+i);
StringBuilder sb = new StringBuilder();
sb.append(System.getProperty("java.home")).append(File.separatorChar).append("bin").append(File.separatorChar).append("java ").append("-cp ")
.append(System.getProperty("java.class.path")).append(" TestMemLeak -client");
if (!multicast)
sb.append(" -nomulticast ").append(lmember);
Map<String, String> c;
int icount=0;
while (true)
{
try
{
try
{
System.out.println("iteration N°" + icount++ +", tqueue.size()=" + tqueue.size() + ", tmap.size()=" + tmap.size());
c = Collections.unmodifiableMap(tmap);
tqueue.put("parent message");
tmap.put("key", "parent value");
}
catch(Exception e)
{
e.printStackTrace();
}
Process p = Runtime.getRuntime().exec(sb.toString());
p.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
break;
}
}
}
private static void doSomeWorkAndExit(HazelcastInstance hzInstance, TestMemLeak tml)
{
try
{
tqueue.put("client message");
IMap<String, String> tmap = hzInstance.getMap("testmemleak-map");
tmap.put("key", "client value");
}
catch (Exception e)
{
//
}
hzInstance.getCluster().removeMembershipListener(tml);
tqueue.removeItemListener(tml);
hzInstance.getLifecycleService().shutdown();
System.exit(0);
}
}
De : haze...@googlegroups.com [mailto:haze...@googlegroups.com]
De la part de Fuad Malikov
Envoyé : jeudi 26 janvier 2012 19:23
À : haze...@googlegroups.com
Objet : Re: Memory leak in 1.9.4.6 using multicast
We just committed to the trunk a code that should improve the situation. Can you please try and see if it solves it. I run your code and everything seems to be fine. You should compile and run the trunk by yourself!
-fuad
I test again with release 1.9.4.8 and I still have out of memory error when using multicast...Is there any things I can do to help ?
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/opDy4HMVBxIJ.