You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/10/20 05:53:54 UTC

[GitHub] [ozone] ChenSammi commented on a change in pull request #2693: HDDS-5794. The misleading "No available thread in pool for past * second" log message in DN StateContext

ChenSammi commented on a change in pull request #2693:
URL: https://github.com/apache/ozone/pull/2693#discussion_r732435509



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java
##########
@@ -616,16 +618,19 @@ public void execute(ExecutorService service, long time, TimeUnit unit)
       }
 
       if (!isThreadPoolAvailable(service)) {
-        long count = threadPoolNotAvailableCount.getAndIncrement();
-        if (count % getLogWarnInterval(conf) == 0) {
-          LOG.warn("No available thread in pool for past {} seconds.",
-              unit.toSeconds(time) * (count + 1));
+        long count = threadPoolNotAvailableCount.incrementAndGet();
+        long unavailableTime =
+            System.currentTimeMillis() - lastHeartbeatSent.get();
+        if (unavailableTime > time && count % getLogWarnInterval(conf) == 0) {
+          LOG.warn("No available thread in pool for the past {} seconds " +
+              "and {} times.", unit.toSeconds(unavailableTime), count);
         }
         return;
       }
-
+      
       threadPoolNotAvailableCount.set(0);
       task.execute(service);
+      lastHeartbeatSent.set(System.currentTimeMillis());

Review comment:
       I wrote a small test to show the System.currentTimeMills.  Between the two runs,  I changed the Linux system.  The System.currentTimeMills is really infected by the Linux time.  That's the meaning of "because it will be broken by settimeofday".   I will change it to  Time.monotonicNow().  Thanks @ayushtkn for the info. 




-- 
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@ozone.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org