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 2020/07/24 06:47:01 UTC

[GitHub] [hadoop-ozone] runzhiwang opened a new pull request #1253: HDDS-4024. Avoid while loop too soon when exception happen

runzhiwang opened a new pull request #1253:
URL: https://github.com/apache/hadoop-ozone/pull/1253


   ## What changes were proposed in this pull request?
   
   When exception throw in `context.execute(executorService, heartbeatFrequency, TimeUnit.MILLISECONDS)`, thread will not sleep and start another while loop immediately, it will cause cpu very high and huge log size.
   
   ![image](https://user-images.githubusercontent.com/51938049/88366638-44339b80-cdbc-11ea-8e68-7c5986e09ecb.png)
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-4024
   
   ## How was this patch tested?
   
   No need add test.
   


----------------------------------------------------------------
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.

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



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


[GitHub] [hadoop-ozone] bshashikant merged pull request #1253: HDDS-4024. Avoid while loop too soon when exception happen

Posted by GitBox <gi...@apache.org>.
bshashikant merged pull request #1253:
URL: https://github.com/apache/hadoop-ozone/pull/1253


   


----------------------------------------------------------------
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.

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



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


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #1253: HDDS-4024. Avoid while loop too soon when exception happen

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #1253:
URL: https://github.com/apache/hadoop-ozone/pull/1253#discussion_r459900072



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
##########
@@ -224,19 +224,25 @@ private void start() throws IOException {
         nextHB.set(Time.monotonicNow() + heartbeatFrequency);
         context.execute(executorService, heartbeatFrequency,
             TimeUnit.MILLISECONDS);
-        now = Time.monotonicNow();
-        if (now < nextHB.get()) {
-          if(!Thread.interrupted()) {
-            Thread.sleep(nextHB.get() - now);
-          }
-        }
       } catch (InterruptedException e) {
         // Some one has sent interrupt signal, this could be because
         // 1. Trigger heartbeat immediately
         // 2. Shutdown has be initiated.
+        LOG.warn("Interrupt the execution.", e);

Review comment:
       Now that sleep is moved outside this `try`, I think interrupted state needs to be restored here.  Otherwise if `execute` is interrupted, this catch clears interrupted state and the thread will sleep below.




----------------------------------------------------------------
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.

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



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


[GitHub] [hadoop-ozone] runzhiwang commented on a change in pull request #1253: HDDS-4024. Avoid while loop too soon when exception happen

Posted by GitBox <gi...@apache.org>.
runzhiwang commented on a change in pull request #1253:
URL: https://github.com/apache/hadoop-ozone/pull/1253#discussion_r459923041



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
##########
@@ -224,19 +224,25 @@ private void start() throws IOException {
         nextHB.set(Time.monotonicNow() + heartbeatFrequency);
         context.execute(executorService, heartbeatFrequency,
             TimeUnit.MILLISECONDS);
-        now = Time.monotonicNow();
-        if (now < nextHB.get()) {
-          if(!Thread.interrupted()) {
-            Thread.sleep(nextHB.get() - now);
-          }
-        }
       } catch (InterruptedException e) {
         // Some one has sent interrupt signal, this could be because
         // 1. Trigger heartbeat immediately
         // 2. Shutdown has be initiated.
+        LOG.warn("Interrupt the execution.", e);

Review comment:
       @adoroszlai Thanks for review. I have updated the patch.




----------------------------------------------------------------
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.

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



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