Skip to content

Commit

Permalink
Ignore when live data after GC size is zero
Browse files Browse the repository at this point in the history
In some cases, the live data after GC size in the GC notification is
reported as 0. We should ignore these notifications.

Closes gh-4497
  • Loading branch information
jonatan-ivanov committed Jan 18, 2024
1 parent 6c8aeb1 commit 8fe8842
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,12 @@ public void handleNotification(Notification notification, Object ref) {
}

// Some GC implementations such as G1 can reduce the old gen size as part of a
// minor GC. To track the
// live data size we record the value if we see a reduction in the long-lived
// heap size or
// after a major/non-generational GC.
if (longLivedAfter < longLivedBefore || shouldUpdateDataSizeMetrics(notificationInfo.getGcName())) {
// minor GC. To track the live data size we record the value if we see a
// reduction in the long-lived
// heap size or after a major/non-generational GC. In some cases,
// longLivedAfter is 0, we ignore those notifications, see: gh-4497.
if (longLivedAfter > 0 && (longLivedAfter < longLivedBefore
|| shouldUpdateDataSizeMetrics(notificationInfo.getGcName()))) {
liveDataSize.set(longLivedAfter);
maxDataSize.set(longLivedPoolNames.stream().mapToLong(pool -> after.get(pool).getMax()).sum());
}
Expand Down

0 comments on commit 8fe8842

Please sign in to comment.