Introducing a JVM parameter to increase the TIMEOUT_FOR_PROCESS_TO_FINISH_MILLIS

XMLWordPrintable

    • 1

      When stopping a build via UI, the agent first sends a signal kill -3. post this, there is a 5-second gap after which it sends a signal of gently kill pids

      INFO   | jvm 1    | 2025/05/07 16:35:10 | 2025-05-07 16:35:10,171 INFO [agentMessageListenerConnector-1] [ProcessManagement] Executing kill -3 430
      INFO   | jvm 1    | 2025/05/07 16:35:15 | 2025-05-07 16:35:15,182 INFO [agentMessageListenerConnector-1] [ProcessManagement] gently killing pids
      INFO   | jvm 1    | 2025/05/07 16:35:15 | 2025-05-07 16:35:15,183 INFO [agentMessageListenerConnector-1] [ProcessManagement] Killing: 430
      INFO   | jvm 1    | 2025/05/07 16:35:15 | 2025-05-07 16:35:15,183 INFO [agentMessageListenerConnector-1] [ProcessManagement] Executing kill 430
      

      There is a 5-second delay between the agent sending the first kill signal and then stopping down the build.

      When we check for this in the Bamboo code, we can see that this duration of 5 seconds in between actions is hardcoded, and there is no way to modify or change this value.

                     log.info("getting stack trace");
              for (int i = relatedPids.length - 1; i > -1; --i) {
                  p = (Map<String, String>) relatedPids[i];
                  generateStackTrace(Integer.parseInt(p.get(ProcessInfo.PROCESS_ID)), p.get(ProcessInfo.COMMAND));
              }
      
              //let's give processes some time to dump stack traces
              sleep(TIMEOUT_FOR_PROCESS_TO_FINISH_MILLIS);
      
              log.info("gently killing pids");
              for (int i = relatedPids.length - 1; i > -1; --i) {
                  p = (Map<String, String>) relatedPids[i];
                  gentlyKillProcess(p.get(ProcessInfo.PROCESS_ID));
              }
      
              sleep(TIMEOUT_FOR_PROCESS_TO_FINISH_MILLIS);
              //renew the list of pids
              pids = getPids();
              log.info("rudely killing pids (only if necessary)");
              for (int i = relatedPids.length - 1; i > -1; --i) {
                  p = (Map<String, String>) relatedPids[i];
                  pids = rudelyKillProcess(p.get(ProcessInfo.PROCESS_ID), p.get(ProcessInfo.COMMAND), pids);
              }
      

      The sleep duration in between is hardcoded as 5000 milliseconds, i.e 5 seconds.

          private static final long TIMEOUT_FOR_PROCESS_TO_FINISH_MILLIS = 5000;
      

      Looking for a feature to have this parameter(TIMEOUT_FOR_PROCESS_TO_FINISH_MILLIS) as a JVM argument and modify this value.

            Assignee:
            Unassigned
            Reporter:
            Anik Sengupta
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: