KBI 311837 Long-Running PowerShell Script Rule Is Always Terminated With Message Aborted While Executing Rule

Version

Argent Advanced Technology – All versions

Date

Monday, 25 May 2020

Summary

If a PowerShell Script Rule requires more than 30 minutes to complete, it is considered a long-running PowerShell Script Rule

If the job was executed by a service as part of a production Relator, it will be terminated abnormally

The Relator trace log shows the message “Aborted while executing Rule”

This only happens when Relator uses the option “Use Shared Monitoring Engine In Pool”

Technical Background

Rule scripts are defined by the customer

There is no guarantee that a Rule script won’t cause resource leakage or consume most of the system’s CPU cycles

A Shared Monitoring Engine process runs other Rules within the same process

It cannot allow a misbehaving Rule script to suffocate other tasks

To prevent these conditions, the Shared Monitoring Engine process is designed to recycle every 30 minutes

A Shared Monitoring Engine process does give some grace time period to allow running Rules to complete

However, a long-running PowerShell Script Rule might always exceed the maximum allowed time

As a result, the Rule is terminated with message “Aborted While Executing Rule”

Resolution

Change the Relator option to “Spawn New Monitoring Engine Process”