You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/12/30 17:37:38 UTC

[GitHub] [nifi] NissimShiman commented on a diff in pull request #6783: NIFI-10974: Incorrect warning message on memory usage from MonitorMemory

NissimShiman commented on code in PR #6783:
URL: https://github.com/apache/nifi/pull/6783#discussion_r1059474487


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java:
##########
@@ -218,7 +218,11 @@ public void onTrigger(final ReportingContext context) {
         }
 
         final double percentageUsed = (double) usage.getUsed() / (double) usage.getMax() * 100D;
-        if (bean.isCollectionUsageThresholdSupported() && bean.isCollectionUsageThresholdExceeded()) {
+        final String percentageThreshold = threshold.substring(0, threshold.length() - 1);
+        final double usageThreshold = Double.parseDouble(percentageThreshold);
+        // In certain scenarios in the monitored memory bean the gcSensor can get stuck in 'on' state before the usage would reach the threshold
+        // and this will cause false exceeded state until the next garbage collection. To eliminate this we are adding a condition with the calculated usage threshold.
+        if (bean.isCollectionUsageThresholdSupported() && bean.isCollectionUsageThresholdExceeded() && percentageUsed > usageThreshold) {

Review Comment:
   I don't think we need check for bean.isCollectionUsageThresholdExceeded() anymore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org