GC locker: Trying a full collection because scavenge failed

Hi,

We've got the following message using PrintGCDetails option in a java 1.4.2 virtual machine (We are not using any GC jvm modifiers beside PrintGCDetails):

"GC locker: Trying a full collection because scavenge failed"

We've got this message just once and after that, we've got lots of minor GC cycles collecting both new and tenured generations. As far as I know, the cause of this is the "full promotion guarantee" (we realized that we had oversized young generation), but

What's does this message mean?Why we're getting this messsage just once (within 24h of gc.log) if we are having many GC cycles collecting both generations?

Thx.

[679 byte] By [david327a] at [2007-11-26 14:07:18]
# 1
you do know you can type the error message into Google, right?
SoulTech2012a at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

Yes we did it, and we haven磘 understand why this situation happend just once in many hours. We consider it strange because system load is almost the same during some hours (high load). Is that "scavenge fail" such an exceptional situation?

Thx.

gc.log (the only exceptional situation in some hours):

...

32495,327: [GC 972495,328: [DefNew: 411264K->411264K(424064K), 0,0000451 secs]972495,328: [Tenured: 520751K->522081K(873856K), 5,3183627 secs] 932015K->522081K(1297920K), 6,4090851 secs]

32527,839: [GC 972527,839: [DefNew: 411264K->411264K(424064K), 0,0000463 secs]972527,839: [Tenured: 522081K->517745K(873856K), 7,5234545 secs] 933345K->517745K(1297920K), 9,1496927 secs]

32557,473: [Full GC 972557,473: [DefNew: 411264K->411264K(424064K), 0,0000404 secs] 929009K->929009K(1297920K), 1,3890446 secs]

GC locker: Trying a full collection because scavenge failed

32558,862: [Full GC 972558,862: [Tenured: 517745K->520179K(873856K), 5,2098964 secs] 929009K->520179K(1297920K), [Perm : 1878K->91878K(91904K)], 6,2891004 secs]

32583,843: [GC 972583,843: [DefNew: 411264K->411264K(424064K), 0,0000481 secs]972583,843: [Tenured: 520179K->515880K(873856K), 5,7079640 secs] 931443K->515880K(1297920K), 6,7821902 secs]

32606,741: [GC 972606,742: [DefNew: 411264K->411264K(424064K), 0,0000445 secs]972606,742: [Tenured: 515880K->519105K(873856K), 5,4717780 secs] 927144K->519105K(1297920K), 6,6073060 secs]

...

david327a at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

The first part of the message is the cause of the GC which means that this GC was invoked when a JNI Critical region was released. Please note that GC is blocked for the period when any thread is in the JNI Critical region. And if GC was requested during that period, that GC is invoked after all the threads come out of this jni critical region.

And the second part of the message means that it is trying a full collection because of the failure of earlier scavenge attempt due to promotion gaurantee failure.

poonambajaja at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
what is gc all about
subhoda at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5
gc is the garbage collector (you can google it for more info)
SoulTech2012a at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6

Poonam has it right. The HotSpot JVM doesn't pin objects that are used in JNI critical regions, so we have to prevent garbage collections while the critical region is in progress. That's what a GC_locker is for. (See the comments on the public methods on class GC_locker at http://12.101.252.19/hotspot/xref/src/share/vm/memory/gcLocker.hpp for details, and follow the implementation if you like.) If a GC_locker notices that it when it exits a JNI critical region that it delayed a collection, it prints that message and forces a full collection.

(I note also that your heap is shaped weirdly, having 424064KB in the young generation and only 873856KB in the old generation. Mostly you seem to be running with 411264KB in the young generation and around 519105KB of live data in the old generation, so given that you are using the serial collector, and there isn't room for all of the young generation in the old generation, we are abandoning young generation collections (quickly, e.g., 0,0000445 secs), but essentially only doing full collections, which might not be as efficient as using young generation collections. Usually for that collector we recommend that the heap be large enough for all your live data plus at least two young generations. See http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html for more details. I'd be surprised if you couldn't reduce your GC load by reshaping your heap, given that your young generation seems to be mostly filled with garbage (though it's hard to tell from the trace you've shown).)

PeterKesslera at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 7

Yes you're right. We realized young generation is oversized for a 1.4 jvm an for this reason why tenured generation is collected so frequently. We think that in 1.5 jvm makes a different approach in estimating promotion size based on previous collections rather than using the worst case (the whole young generation). Is this correct?

We have taken a conservative approach sizing young generation to a max size of 200 MB. In addition to this we are trying in another server with concurrent collection just to be sure that we take the best decission (We are waiting for the results).

david327a at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 8

In JDK-1.5.0 we figured out how to survive a young generation collection that runs out of space to promote objects from the young generation to the old generation. I'm glad you like it.

The concurrent collector should give you consistently shorter pauses, but maybe less throughput (e.g., more time spent in collections). If you have more than one processor we also have a parallel collector. One size does not fit all, which is why we offer different collectors.

PeterKesslera at 2007-7-8 1:53:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...