aborting build may send multiple TERM signals

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major
    • Component/s: core
    • Environment:
      OS: Docker container (jenkins/jenkins:lts) (2.73.3)

      We have a custom Python script that handles building out software (and uploading artifacts). I recently added a signal handler for handling aborted jobs. But, I am seeing inconsistent signals being sent. It LOOKS like Jenkins is sometimes sending multiple TERM signals (after 1 second).

      Here are 2 outputs for the exact same job run about 10 minutes apart:

      Started by user craig
      Building in workspace /var/jenkins_home/jobs/test1/workspace
      [workspace] $ /bin/sh -xe /tmp/jenkins3014862914468653233.sh
      + /opt/tools/builder.py
      [DEBUG] MyBuilder (31) - 2  945 - Logger initialized: MyBuilder
      [DEBUG] MyBuilder (43) - 3  945 - Inside call.
      [INFO] MyBuilder (76) - 3  946 - my pid: 975
      [INFO] MyBuilder (77) - 3  946 - process group: 7
      [INFO] MyBuilder (79) - 3  946 - Sleeping for: 200 secs
      [WARNING] MyBuilder (57) - 38936  878 - Handling SIGTERM.
      [WARNING] MyBuilder (58) - 38938  880 - PID: 975
      [WARNING] MyBuilder (59) - 38938  880 - Signal number: 15
      [WARNING] MyBuilder (60) - 38938  880 - Frame: <frame object at 0x7f480ad3e3e8>
      [WARNING] MyBuilder (61) - 38938  880 - Frame code: <code object simple_build at 0x7f480af01c90, file "/opt/tools/builder.py", line 73>
      [WARNING] MyBuilder (67) - 38938  880 - Running clean up...
      [INFO] MyBuilder (70) - 38938  880 - Clean sleep: 0
      Build was aborted
      Aborted by craig
      Finished: ABORTED
      
      Started by user craig
      Building in workspace /var/jenkins_home/jobs/test1/workspace
      [workspace] $ /bin/sh -xe /tmp/jenkins1837866951349054690.sh
      + /opt/tools/builder.py
      [DEBUG] MyBuilder (31) - 2  730 - Logger initialized: MyBuilder
      [DEBUG] MyBuilder (43) - 3  731 - Inside call.
      [INFO] MyBuilder (76) - 3  731 - my pid: 1308
      [INFO] MyBuilder (77) - 4  731 - process group: 7
      [INFO] MyBuilder (79) - 4  731 - Sleeping for: 200 secs
      [WARNING] MyBuilder (57) - 9614  342 - Handling SIGTERM.
      [WARNING] MyBuilder (58) - 9614  342 - PID: 1308
      [WARNING] MyBuilder (59) - 9614  342 - Signal number: 15
      [WARNING] MyBuilder (60) - 9615  342 - Frame: <frame object at 0x7f40a38763e8>
      [WARNING] MyBuilder (61) - 9615  342 - Frame code: <code object simple_build at 0x7f40a3a39c90, file "/opt/tools/builder.py", line 73>
      [WARNING] MyBuilder (67) - 9615  342 - Running clean up...
      [INFO] MyBuilder (70) - 9615  342 - Clean sleep: 0
      [WARNING] MyBuilder (48) - 9617  345 - Handling SECOND SIGTERM.
      [WARNING] MyBuilder (49) - 9617  345 - SECOND PID: 1308
      Build was aborted
      Aborted by craig
      Finished: ABORTED
      

      Those are just 2 examples. Other jobs had other interesting and inconsistent output. Sometimes, the signal handling routine is called 3 times.

      I have attached the Python script for reference. (

      (Note: I am new to Jenkins, so don't discount user-error. :/ )

            Assignee:
            Unassigned
            Reporter:
            Craig Sebenik
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: