Cancelling a Windows or UNIX job does not cancel the child processes
search cancel

Cancelling a Windows or UNIX job does not cancel the child processes

book

Article ID: 423485

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine CA Automic One Automation Automic SaaS

Issue/Introduction

When a job (Unix or Windows) is manually terminated or canceled via the Automic Web Interface (AWI), the main process is killed, but its child processes (sub-processes) continue to run on the operating system as "process remnants."

  • On Linux/Unix: A script launching background tasks (e.g., sleep &) leaves the background tasks running even after the parent script is killed.

  • On Windows: A job launching external scripts or binaries leaves those binaries running in the background.

Environment

Version: Any

Agent type: Windows or UNIX/Linux

Cause

This behavior is typically due to how the Operating System handles process signals:

  1. Unix/Linux: By default, the Agent sends a SIGKILL (kill -9). This immediately terminates the parent process, but the parent does not have the opportunity to pass the signal to its children, leaving them "orphaned."

  2. Windows: Standard process termination may not automatically include the entire process tree unless specific job objects are used.

Resolution

For Unix/Linux Agents

Modify the Agent's .ini file to use a signal that allows for graceful termination of the process tree.

  1. Open the Unix Agent configuration file (ucxjxxx.ini).

  2. Locate the killSignal= parameter.

  3. Change the value from SIGKILL (default) to SIGTERM.

    • killSignal=SIGTERM

  4. Restart the Agent.

  5. Note: This allows the process to receive a kill -15, which typically triggers the termination of child processes depending on the script's logic.

For Windows Agents

Enable the use of Windows Job Objects to ensure the entire process tree is terminated.

  1. Open the Windows Agent configuration file (ucxjwx6.ini).

  2. Set the following parameter:

    • useJobObject=1

  3. Restart the Agent.

  4. This ensures that when the main job is killed, Windows terminates all processes associated with that Job Object.