• Documentation
  • Status: Resolved
  • 2 Major
  • Resolution: Not a Bug
  • teck
  • Reporter: shortmem
  • February 25, 2013
  • 0
  • Watchers: 2
  • September 06, 2013
  • September 06, 2013

Description

I think it’s worth mentioning that using jdk 7 with G1 enabled may lead to jvm crashes in gnu’s Trove library (and who knows where else!), since Terracotta seems to make use of them internally (e.g. in BaseDNAEncodingImpl).

Users should be discouraged to turn -XX:+UseG1GC in jdk7 update 10 or bellow. I didn’t test in newer jvm versions, however it seems that there’s been only security fixes up to update 15.

One can easily reproduce G1 bug with the following test (tested on OSX Lion and on RHEL 5[2.6.18-194.el5]).

import gnu.trove.map.hash.TObjectIntHashMap; import org.testng.annotations.Test;

public class JDK7CrashTests {

@Test
public void run() throws InterruptedException \{

	final Runnable r = new Runnable() \{

		@Override
		public void run() \{
			final TObjectIntHashMap<Object> map = new TObjectIntHashMap<>();

			for (int j = 0; j < 1000 \* 1000; j++) \{
				map.put(new Object(), j);
			\}
			map.clear();
		\}
	\};

	final Thread[] threads = \{ new Thread(r), new Thread(r), new Thread(r), new Thread(r) \};

	for (final Thread t : threads) \{
		t.start();
	\}

	for (final Thread t : threads) \{
		t.join();
	\}

\} \}

With more threads the bug manifests quicker. I couldn’t reproduce with a single thread in this standalone app, however on my appserver the crash did occur very often even when a single Thread was performing a similar loop and the vm on TC server crashed once under G1.

Comments

Tim Eck 2013-02-25

Thanks for posting this. Have you already submitted this to oracle? It is their bug of course but it is good to note in our system too.

If you have a link to the oracle bug, please post it here.

Cleber Muramoto 2013-02-25

Tim, I tried to post on oracle bug database (about a month ago) once my app suffered from this, but the website was horribly slow. It seems they’re migrating it to JIRA (finally!) but it’s not open to the community yet. Anyway, I’ll try a few more times and update this JIRA with the bug id if by any chance I succeed.

Tim Eck 2013-09-06

we no longer use the trove library (at least as of 4.0.x)