Issue Details (XML | Word | Printable)

Key: NUCCORE-529
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Peter Dettman
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Intermittent unit test failure of SoftValueMapTest due to OutOfMemoryError

Created: 21/May/10 07:52 AM   Updated: 11/Jun/10 01:38 PM   Resolved: 21/May/10 03:19 PM
Component/s: None
Affects Version/s: 2.1.0.m3
Fix Version/s: 2.1.0.release

File Attachments: 1. Text File NUCCORE-529.patch (1 kB)

Environment:
java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)


 Description  « Hide
testMemoryReclamation(org.datanucleus.util.SoftValueMapTest) Time elapsed: 58.849 sec <<< ERROR!
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.Arrays.copyOfRange(Arrays.java:3209)
    at java.lang.String.<init>(String.java:215)
    at java.lang.StringBuilder.toString(StringBuilder.java:430)
    at org.datanucleus.util.ReferenceValueMapTestCase.testMemoryReclamation(ReferenceValueMapTestCase.java:51)

This only started happening since I recently moved to 64 bit OS/JVM.

The exception is explained here: http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#cms.oom, where it is also explained that it can be disabled by specifying -XX:-UseGCOverheadLimit.

I have confirmed this stops the error for me by adding argLine to surefire plugin:

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-XX:-UseGCOverheadLimit</argLine>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>

The problem with that is that UseGCOverheadLimit was only introduced in Java 6. An alternative that also fixes my immediate issue is to set -Xmx128m instead (as a side-benefit the test also then completes in a few seconds vs ~1 min).

I am attaching a patch that uses profiles to specify the surefire argLine based on the java version. Take your pick of the best option.



Peter Dettman made changes - 21/May/10 07:55 AM
Field Original Value New Value
Attachment NUCCORE-529.patch [ 11177 ]
Andy Jefferson added a comment - 21/May/10 01:50 PM
I'd probably favour a
<argLine>-Xmx128m</argLine> <!-- For SoftValueMapTest -->
in the surefire plugin section as default, and then if someone wanted to enable a Java6 profile add in the other.

Personally I use JDK1.6 so not a problem, but someone somewhere may complain if we just went to that as default

Peter Dettman added a comment - 21/May/10 03:19 PM
Added the -Xmx128m for now; will revisit if the exception pops up again.

Peter Dettman made changes - 21/May/10 03:19 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 2.1.0.release [ 10836 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 11/Jun/10 01:38 PM
Status Resolved [ 5 ] Closed [ 6 ]