Affects Version/s: None
Fix Version/s: None
Currently (as of 3.12.2) , not all promises can be timed out.
Commonly the ifelapsed and expireafter attributes in action bodies are used to control the frequency of promises across agent executions.
- ifelapsed: The number of minutes before next allowed assessment of a promise is set using ifelapsed. This overrides the global settings. Promises which take a long time to verify should usually be protected with a long value for this parameter.
- expireafter: The Number of minutes a promise is allowed to run before the agent is terminated.
- Note: Not to be confused with body contain exec_timeout in commands type promises, the original agent does not terminate the promise. When a subsequent agent notices that a promise actuation has persisted for longer than expireafter the subsequent agent will kill the agent that appears to be stuck on the long running promise.
commands type promises can use contain bodies which have exec_timeout, but contain bodies are not usable for any other promise type.
CFE-274 tracks a request to be able to set a custom timeout for readtcp(). One of the comments suggested a general timeout for all system functions, but I think that this would make sense as an action body attribute to timeout any long running promise.
Since action bodies can be used with any promise type, this is a natural place to introduce an attribute that applies to any promise type.
This would be useful for preventing a hung command executed by execresult() or returnszero() as well as protecting against agent run slow-downs caused by readtcp(), or any other function.
A promise that is timed out should work with repair_timeout in classes bodies, and be treated as a promise that is not kept or repaired.
No, they don't. Indeed, they could get stuck, and that could result in an agent pile up.
The expireafter attribute in action bodies is related to promise locking, which isn't supported by vars type promises.
Executing the example:
The warning tells us that the expireafter action body attribute is not supported for vars type promises.
Commands promises can use contain bodies and the exec_timeout attribute to interrupt a promise execution, but contain bodies are not valid for vars type promises.
The execution output shows us that contain bodies are not valid for vars type promises in agent bundles.
You can use an external command like timeout
Executing the example policy:
We can see that result is left with an empty value since it never got to echo and that the entire agent execution lasted 3 seconds.