Hope anyone can enlighten me about a special garbage collection notification with all the data entries being zero inside. Thanks in advance!
So what happens is that we have code to register to receive Garbage Collection JMX Notifications, something like the following:
if (notification.getType().equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) { //get the information associated with this notification GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData) notification.getUserData());
......
}
And then we log various information (e.g., GC name, cause, duration, start/end time) from GarbageCollectionNotificationInfo we received. And recently, we received GarbageCollectionNotificationInfo with all the information being zero which does not look like an actually real GC, for example, we got the following GC:
GC Name: ConcurrentMarkSweep
GC Cause: Allocation Failure
GC Action: end of major GC
GC started at: 0 ms since JVM started
GC ended at: 0 ms since JVM started
GC duration: 0 ms
The number of collections that this collector has done: 0
So I do not quite understand how this kind of "GC" could ever occur (from the above, we see this GC occurred at the same time when JVM starts), this does not actually look like a real GC at all. And before this weird GC, we have some normal GC with a positive end time and positive duration. From our log, we also noticed before the above particular example, there is a normal CMS GC at the same system time but with positive duration and end time, so this GC looks like to me a 'shadowed' one associated with the normal one, but all of these are my guess, essentially, I do not understand two things here: