Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63867

Timeouts send signals to random processes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline
    • Jenkins 2.235.5
      Pipeline: Groovy 2.83
      Pipeline: Job 2.40

      Consider a following procedural (groovy) pipeline:

      ```
      timeout(1) {
          sh(script: '''
              trap 'echo "jenkins int"' SIGINT SIGTERM
              ./bash_script.sh
          ''')
      }
      ```

      where the `bash_script.sh` looks like this:

      ```bash
      trap 'echo "in bash script"' SIGINT SIGTERM
      sleep inf &
      wait -n
      ```

      When the timeout lapses, neither of these traps get fired and the SIGINT signal gets sent to the backgrounded sleep process spawned in the script.

      If you spawn multiple such background processes in a script, there appears to be no good way to tell which one received a signal and if its termination was due to a timeout signal. If the process "just" happens to exit with exit code 0 when it receives `SIGINT` then the whole step will be marked as //successful// and not "timed out".

            Unassigned Unassigned
            nagisa Simonas Kazlauskas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: