DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

CacheReferencesTest fails on Mac with JDK 1.7/1.8 #1568

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.google.common.cache.CacheReferencesTest
Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 155.376 sec <<< 
FAILURE!

Results :

Failed tests: 
  testCleanupOnReferenceCollection(com.google.common.cache.CacheReferencesTest): expected:<1> but was:<2>

@@@@

$ git rev-parse HEAD
cff5df6b48b892574975dc045f6ed3552d4b3d1d

It fails with:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 
14:51:28+0100)
Maven home: /opt/local/share/java/maven3
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

and

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 
14:51:28+0100)
Maven home: /opt/local/share/java/maven3
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

and

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 
14:51:28+0100)
Maven home: /opt/local/share/java/maven3
Java version: 1.8.0-ea, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

But works with:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 
14:51:28+0100)
Maven home: /opt/local/share/java/maven3
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

Running the tests on JDK 1.7/1.8 takes very long compared to running them with 
JDK 1.6.

Original issue reported on code.google.com by sebastia...@gmail.com on 4 Nov 2013 at 7:40

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 20 Nov 2013 at 8:13

GoogleCodeExporter commented 9 years ago
This might be a 64-bit thing, whether a bug in the test or a 64-bit-specific 
JIT (or something) problem. I say that because I'm seeing failures and 
mysterious early terminations when running the test with a 64-bit Linux JDK7. 
(The mysterious early terminations might conceivably be caused by our internal 
build system, though I should note that the build system is reporting FAILED 
and not TIMEOUT.)

...
Running com.google.common.cache.CacheReferencesTest
Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1,535.714 sec 
<<< FAILURE!
Running com.google.common.cache.EmptyCachesTest
<end of log>

...
Running com.google.common.cache.CacheReferencesTest
<end of log>

Original comment by cpov...@google.com on 9 Dec 2013 at 9:24

GoogleCodeExporter commented 9 years ago
Here's the failure that I'm getting when I run with a couple flags 
(-Dtest.include="**/CacheReferencesTest.java" -Dsurefire.useFile=false):

Running com.google.common.cache.CacheReferencesTest
Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 279.781 sec <<< 
FAILURE!
testCleanupOnReferenceCollection(com.google.common.cache.CacheReferencesTest)  
Time elapsed: 279.67 sec  <<< FAILURE!
junit.framework.AssertionFailedError: expected:<1> but was:<2>
  at junit.framework.Assert.fail(Assert.java:47)
  at junit.framework.Assert.failNotEquals(Assert.java:283)
  at junit.framework.Assert.assertEquals(Assert.java:64)
  at junit.framework.Assert.assertEquals(Assert.java:130)
  at junit.framework.Assert.assertEquals(Assert.java:136)
  at com.google.common.cache.CacheReferencesTest.assertCleanup(CacheReferencesTest.java:179)
  at com.google.common.cache.CacheReferencesTest.testCleanupOnReferenceCollection(CacheReferencesTest.java:146)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at junit.framework.TestCase.runTest(TestCase.java:168)
  at junit.framework.TestCase.runBare(TestCase.java:134)
  at junit.framework.TestResult$1.protect(TestResult.java:110)
  at junit.framework.TestResult.runProtected(TestResult.java:128)
  at junit.framework.TestResult.run(TestResult.java:113)
  at junit.framework.TestCase.run(TestCase.java:124)
  at junit.framework.TestSuite.runTest(TestSuite.java:243)
  at junit.framework.TestSuite.run(TestSuite.java:238)
  at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
  at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
  at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
  at com.sun.proxy.$Proxy0.invoke(Unknown Source)
  at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
  at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

Here's the failing assertion:
http://code.google.com/p/guava-libraries/source/browse/guava-tests/test/com/goog
le/common/cache/CacheReferencesTest.java?name=release15#179

Original comment by cpov...@google.com on 9 Dec 2013 at 9:54

GoogleCodeExporter commented 9 years ago
Hmm, if the problem is the use of 64-bit JVMs, I have a theory: 
testCleanupOnReferenceCollection attempts to "fill up heap so soft references 
get cleared." If the 64-bit JVMs have a bigger heap, this would naturally take 
much longer, if it happens at all.

Original comment by cpov...@google.com on 9 Dec 2013 at 10:23

GoogleCodeExporter commented 9 years ago
And it looks like by "fill up heap" it means "create bigger and bigger byte 
arrays until the array is 1 GB and then just keep creating 1 GB arrays and 
garbage collecting them".

Original comment by cgdecker@google.com on 9 Dec 2013 at 10:36

GoogleCodeExporter commented 9 years ago
If that's the problem, then a possible solution is to limit the memory 
available to Maven's test runner. For now, though, I'm going to suppress the 
test.

Original comment by cpov...@google.com on 10 Dec 2013 at 12:23

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08