Termination Harms Inner Block

This type of issue only applies for a block that has inner block(s). The enclosing block is terminated, but there is an inner block that is not terminated.

If an inner block is participated in the activity step that terminates its enclosing block, the inner block is still in a state other than final state. If it does not, it does not allow implicit termination.

Severity

General Solutions

Since this warning is related to incorrect interaction between an inner block and its enclosing block, there are, in general, two actions that can be taken to solve it.

  1. Change the enclosing block.
  2. Change the inner block's contract (and maybe its corresponding activity diagram).

Of course, you can modify both the enclosing and the inner blocks. The goal is to make the inner block and its enclosing block consistent with each another.

Note that you cannot always change the inner block. This is the case when the block is taken from a library or created by other developer. Moreover, modifying the inner block might affect other blocks that also use the inner block.

When you modify the enclosing block, you may need to check whether the modification affects other part of the block including other inner blocks.

Example

An example of this type of warning is depicted in the following figure.

While inner block Periodic Notification is in state active, enclosing block Listener is terminated by the activity step that includes parameter node end, operation terminate and output node ended.

As can be observed from the contract of the inner block on the bottom right hand-side, there are two transitions from state active:

  • A self-transition of state active labelled with /data.
  • A transition to a final state labelled with stop/stopped.

The only activity step that will terminate the inner block must contain pins stop and stopped. However, the activity step that terminates the enclosing block does not contain these pins.

Possible Fixe(s)

Depending on the behavior of your application and what you are allowed to do, there are several possible solutions. Here, we show two.

Modify the Enclosing Block

The figure below depicts one choice that changes the enclosing block and leaves the inner block unchanged.

  • input parameter node end is now connected to pin stop,
  • pin stopped is connected to operation terminate.

Therefore, the activity step that terminates the enclosing block is modified so that it also includes pins stop and stopped of the inner block.

Modify the Inner Block

Modification of the contract of the inner block is shown in the following figure.

Here, we do not change the activity of the inner block.

This solution means that when enclosing block Listener is terminated, inner block Periodic Notification can be terminated within the same activity step.