Detecting infinite loops in services and process instances
There are a set of loop detection properties that you can use to detect and handle infinite loops in services and process instances.
loop-detection-duration property
for the service engine and one for the business process definition
(BPD) engine. The value in each property sets the expected maximum
length a service or BPD instance should run in seconds or a value
of -1 for an unlimited duration. The two engines
differ in what happens when the service or BPD instance exceeds the
maximum duration: If a service runs for longer, the service engine either outputs a message to the SystemOut.log or stops the service. The
loop-detection-exceptionproperty determines which action that the engine takes. If it is set totrue, the engine stops the service and generates an exception. By default, this property is set tofalse.The exception is used to notify the BPD instance that contains the service that the service engine has stopped.
- If a BPD instance runs for longer, the BPD engine outputs a message to the SystemOut.log. An administrator can use this information to suspend or otherwise handle the instance.
<service-engine>
<loop-detection-duration>120</loop-detection-duration>
<loop-detection-exception>false</loop-detection-exception>
</service-engine>
<bpd-engine>
<loop-detection-duration>60</loop-detection-duration>
</bpd-engine>loop-detection-duration values
for the service engine: CWLLG0872W: Service '{0}' has been running for {1} seconds and might be in an infinite loop.CWLLG0873W: Service '{0}' for instance {1} has been running for {2} seconds and might be in an infinite loop.CWLLG0874E: Service '{0}' was terminated after {1} seconds because it might be in an infinite loop.CWLLG0875E: Service '{0}' for instance {1} was terminated after {2} seconds because it might be in an infinite loop.
If BPD instances are not in an infinite loop but the following
message is in the SystemOut.log, consider changing
the loop-detection-duration values for the BPD engine: CWLLG0871W:
Business process definition (BPD) instance {0} has been running for
{1} seconds and might be in an infinite loop.
For example, to change the service engine to stop the service flow after four minutes (240 seconds), add the following code to the appropriate 100Custom.xml file:
<server>
<service-engine>
<loop-detection-duration merge="replace">240</loop-detection-duration>
<loop-detection-exception merge="replace">true</loop-detection-exception>
</service-engine>
</server>