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 2020/04/16 17:25:56 UTC

[GitHub] [nifi-minifi-cpp] arpadboda opened a new pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly

arpadboda opened a new pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly
URL: https://github.com/apache/nifi-minifi-cpp/pull/759
 
 
   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the LICENSE file?
   - [ ] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
   

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly

Posted by GitBox <gi...@apache.org>.
arpadboda commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly
URL: https://github.com/apache/nifi-minifi-cpp/pull/759#discussion_r410038399
 
 

 ##########
 File path: libminifi/src/c2/C2Agent.cpp
 ##########
 @@ -90,22 +87,16 @@ C2Agent::C2Agent(const std::shared_ptr<core::controller::ControllerServiceProvid
         request_mutex.unlock();
       }
 
-      if ( time_since > heart_beat_period_ ) {
-        last_run_ = now;
-        try {
-          performHeartBeat();
-        }
-        catch(const std::exception &e) {
-          logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
-        }
-        catch(...) {
-          logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
-        }
+      try {
+        performHeartBeat();
+      } catch(const std::exception &e) {
+        logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
+      } catch(...) {
+        logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
       }
 
       checkTriggers();
 
-      std::this_thread::sleep_for(std::chrono::milliseconds(heart_beat_period_ > 500 ? 500 : heart_beat_period_));
 
 Review comment:
   Yes we do.
   
   It's done in this call:
   ```
   registerUpdateListener(agent, agent->getHeartBeatDelay());
   ```
   
   Which creates the afterexecute based on the heartbeat delay:
   
   ```
   std::unique_ptr<utils::AfterExecute<Update>> after_execute = std::unique_ptr<utils::AfterExecute<Update>>(new UpdateRunner(isStateMonitorRunning(), delay));
   ```
   
   So this works fine without any additional hack inside the callback.
   I also based it on master. 
   
   If you want to fix it any other way in 1169, I'm fine  with that, just make sure heartbeat timing is the responsibility of threadpool scheduling and not some blackmagic done in the callbacks. 

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly

Posted by GitBox <gi...@apache.org>.
msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly
URL: https://github.com/apache/nifi-minifi-cpp/pull/759#discussion_r410415198
 
 

 ##########
 File path: libminifi/src/c2/C2Agent.cpp
 ##########
 @@ -90,22 +87,16 @@ C2Agent::C2Agent(const std::shared_ptr<core::controller::ControllerServiceProvid
         request_mutex.unlock();
       }
 
-      if ( time_since > heart_beat_period_ ) {
-        last_run_ = now;
-        try {
-          performHeartBeat();
-        }
-        catch(const std::exception &e) {
-          logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
-        }
-        catch(...) {
-          logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
-        }
+      try {
+        performHeartBeat();
+      } catch(const std::exception &e) {
+        logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
+      } catch(...) {
+        logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
       }
 
       checkTriggers();
 
-      std::this_thread::sleep_for(std::chrono::milliseconds(heart_beat_period_ > 500 ? 500 : heart_beat_period_));
 
 Review comment:
   This is how it is done in 1169 if that is what you mean by letting threadpool to take the scheduling.
        try {
           performHeartBeat();
         }
         catch(const std::exception &e) {
           logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
         }
         catch(...) {
           logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
         }
   
         checkTriggers();
         return utils::TaskRescheduleInfo::RetryIn(std::chrono::milliseconds(heart_beat_period_));

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly

Posted by GitBox <gi...@apache.org>.
msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly
URL: https://github.com/apache/nifi-minifi-cpp/pull/759#discussion_r409913141
 
 

 ##########
 File path: libminifi/src/c2/C2Agent.cpp
 ##########
 @@ -90,22 +87,16 @@ C2Agent::C2Agent(const std::shared_ptr<core::controller::ControllerServiceProvid
         request_mutex.unlock();
       }
 
-      if ( time_since > heart_beat_period_ ) {
-        last_run_ = now;
-        try {
-          performHeartBeat();
-        }
-        catch(const std::exception &e) {
-          logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
-        }
-        catch(...) {
-          logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
-        }
+      try {
+        performHeartBeat();
+      } catch(const std::exception &e) {
+        logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
+      } catch(...) {
+        logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
       }
 
       checkTriggers();
 
-      std::this_thread::sleep_for(std::chrono::milliseconds(heart_beat_period_ > 500 ? 500 : heart_beat_period_));
 
 Review comment:
   Do we honor the heartbeat period here? I mean doesn't the threadpool schedule this task immediately or at a different delay interval than the heartbeat period.
   Also, I believe this PR will conflict with MINFICPP-1169. In that PR we are using the new theadpool changes.

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly

Posted by GitBox <gi...@apache.org>.
msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly
URL: https://github.com/apache/nifi-minifi-cpp/pull/759#discussion_r409913141
 
 

 ##########
 File path: libminifi/src/c2/C2Agent.cpp
 ##########
 @@ -90,22 +87,16 @@ C2Agent::C2Agent(const std::shared_ptr<core::controller::ControllerServiceProvid
         request_mutex.unlock();
       }
 
-      if ( time_since > heart_beat_period_ ) {
-        last_run_ = now;
-        try {
-          performHeartBeat();
-        }
-        catch(const std::exception &e) {
-          logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
-        }
-        catch(...) {
-          logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
-        }
+      try {
+        performHeartBeat();
+      } catch(const std::exception &e) {
+        logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
+      } catch(...) {
+        logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
       }
 
       checkTriggers();
 
-      std::this_thread::sleep_for(std::chrono::milliseconds(heart_beat_period_ > 500 ? 500 : heart_beat_period_));
 
 Review comment:
   Do we honor the heartbeat period here? I mean doesn't the threadpool schedule this task immediately or at a different delay interval that the heartbeat period.
   Also, I believe this PR will conflict with MINFICPP-1169. In that PR we are using the new theadpool changes.

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly

Posted by GitBox <gi...@apache.org>.
msharee9 commented on a change in pull request #759: MINIFICPP-1193 - heartbeat interval config doesn't work properly
URL: https://github.com/apache/nifi-minifi-cpp/pull/759#discussion_r410415198
 
 

 ##########
 File path: libminifi/src/c2/C2Agent.cpp
 ##########
 @@ -90,22 +87,16 @@ C2Agent::C2Agent(const std::shared_ptr<core::controller::ControllerServiceProvid
         request_mutex.unlock();
       }
 
-      if ( time_since > heart_beat_period_ ) {
-        last_run_ = now;
-        try {
-          performHeartBeat();
-        }
-        catch(const std::exception &e) {
-          logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
-        }
-        catch(...) {
-          logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
-        }
+      try {
+        performHeartBeat();
+      } catch(const std::exception &e) {
+        logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
+      } catch(...) {
+        logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
       }
 
       checkTriggers();
 
-      std::this_thread::sleep_for(std::chrono::milliseconds(heart_beat_period_ > 500 ? 500 : heart_beat_period_));
 
 Review comment:
   This is how it is done in 1169 if that is what you mean by letting threadpool to take the scheduling.
   ```     
   try {
           performHeartBeat();
         }
         catch(const std::exception &e) {
           logger_->log_error("Exception occurred while performing heartbeat. error: %s", e.what());
         }
         catch(...) {
           logger_->log_error("Unknonwn exception occurred while performing heartbeat.");
         }
   
         checkTriggers();
         return utils::TaskRescheduleInfo::RetryIn(std::chrono::milliseconds(heart_beat_period_));```

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


With regards,
Apache Git Services