You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "briansolo1985 (via GitHub)" <gi...@apache.org> on 2023/06/29 06:54:42 UTC

[GitHub] [nifi] briansolo1985 opened a new pull request, #7448: NIFI-11761 Fixed MiNiFi restart issue when graceful shutdown period expires. MiNiFi restart sends bootstrap to background

briansolo1985 opened a new pull request, #7448:
URL: https://github.com/apache/nifi/pull/7448

   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-11761](https://issues.apache.org/jira/browse/NIFI-11761)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [x] Build completed using `mvn clean install -P contrib-check`
     - [x] JDK 17
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


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


[GitHub] [nifi] bejancsaba commented on a diff in pull request #7448: NIFI-11761 Fixed MiNiFi restart issue when graceful shutdown period expires. MiNiFi restart sends bootstrap to background

Posted by "bejancsaba (via GitHub)" <gi...@apache.org>.
bejancsaba commented on code in PR #7448:
URL: https://github.com/apache/nifi/pull/7448#discussion_r1246295415


##########
minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java:
##########
@@ -112,6 +114,19 @@ private void gracefulShutDownMiNiFiProcess(long minifiPid) throws IOException {
         if (minifiPid != UNINITIALIZED) {
             processUtils.shutdownProcess(minifiPid, "MiNiFi has not finished shutting down after {} seconds. Killing process.",
                 gracefulShutdownParameterProvider.getGracefulShutdownSeconds());
+            int maxRetry = 5;
+            while (processUtils.isProcessRunning(minifiPid)) {
+                if (maxRetry == 0) {
+                    throw new IOException("Failed to stop MiNiFi process. MiNiFi process is still running after graceful shutdown has completed");

Review Comment:
   We could explicitly say here "...after graceful shutdown completed and killing attempted afterwards" or something along those lines I think we can't get here only if graceful time expired kill was attempted but still the process didn't stop. Right?



##########
minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java:
##########
@@ -112,6 +114,19 @@ private void gracefulShutDownMiNiFiProcess(long minifiPid) throws IOException {
         if (minifiPid != UNINITIALIZED) {
             processUtils.shutdownProcess(minifiPid, "MiNiFi has not finished shutting down after {} seconds. Killing process.",
                 gracefulShutdownParameterProvider.getGracefulShutdownSeconds());
+            int maxRetry = 5;
+            while (processUtils.isProcessRunning(minifiPid)) {
+                if (maxRetry == 0) {
+                    throw new IOException("Failed to stop MiNiFi process. MiNiFi process is still running after graceful shutdown has completed");
+                }
+                CMD_LOGGER.debug("MiNiFi process is still running after shutdown has completed");

Review Comment:
   I think this could be WARN as if we are here that is already not good



##########
minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java:
##########
@@ -112,6 +114,19 @@ private void gracefulShutDownMiNiFiProcess(long minifiPid) throws IOException {
         if (minifiPid != UNINITIALIZED) {
             processUtils.shutdownProcess(minifiPid, "MiNiFi has not finished shutting down after {} seconds. Killing process.",
                 gracefulShutdownParameterProvider.getGracefulShutdownSeconds());
+            int maxRetry = 5;

Review Comment:
   I'm not sure whether it would be useful or not to externalise at least this one (maybe the sleep time is not justified but it can be argued that this makes sense to be configurable) what do you think?



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


[GitHub] [nifi] ferencerdei commented on pull request #7448: NIFI-11761 Fixed MiNiFi restart issue when graceful shutdown period expires. MiNiFi restart sends bootstrap to background

Posted by "ferencerdei (via GitHub)" <gi...@apache.org>.
ferencerdei commented on PR #7448:
URL: https://github.com/apache/nifi/pull/7448#issuecomment-1613216957

   Thanks for the update +1 from my side


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


[GitHub] [nifi] briansolo1985 commented on pull request #7448: NIFI-11761 Fixed MiNiFi restart issue when graceful shutdown period expires. MiNiFi restart sends bootstrap to background

Posted by "briansolo1985 (via GitHub)" <gi...@apache.org>.
briansolo1985 commented on PR #7448:
URL: https://github.com/apache/nifi/pull/7448#issuecomment-1613154149

   Thanks for your comments. I tried addressed all of them. I had to change the log message differently because with moving the related code to UnixProcessUtils the context has changed as well.


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


[GitHub] [nifi] bejancsaba closed pull request #7448: NIFI-11761 Fixed MiNiFi restart issue when graceful shutdown period expires. MiNiFi restart sends bootstrap to background

Posted by "bejancsaba (via GitHub)" <gi...@apache.org>.
bejancsaba closed pull request #7448: NIFI-11761 Fixed MiNiFi restart issue when graceful shutdown period expires. MiNiFi restart sends bootstrap to background
URL: https://github.com/apache/nifi/pull/7448


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


[GitHub] [nifi] ferencerdei commented on a diff in pull request #7448: NIFI-11761 Fixed MiNiFi restart issue when graceful shutdown period expires. MiNiFi restart sends bootstrap to background

Posted by "ferencerdei (via GitHub)" <gi...@apache.org>.
ferencerdei commented on code in PR #7448:
URL: https://github.com/apache/nifi/pull/7448#discussion_r1246230431


##########
minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java:
##########
@@ -112,6 +114,19 @@ private void gracefulShutDownMiNiFiProcess(long minifiPid) throws IOException {
         if (minifiPid != UNINITIALIZED) {
             processUtils.shutdownProcess(minifiPid, "MiNiFi has not finished shutting down after {} seconds. Killing process.",
                 gracefulShutdownParameterProvider.getGracefulShutdownSeconds());
+            int maxRetry = 5;
+            while (processUtils.isProcessRunning(minifiPid)) {

Review Comment:
   What do you think about putting this into the processUtils' killProcessTree method? it is called from multiple places (from the stopRunner directly, and from the shutdownProcess method as well)



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