FUML 1.0b2 NO IDEA Avatar
  1. OMG Issue

FUML — The call to receiveOffer at the end of ActionActivation::fire could can cause an infinite recursion

  • Key: FUML-5
  • Legacy Issue Number: 13311
  • Status: closed  
  • Source: Model Driven Solutions ( Mr. Ed Seidewitz)
  • Summary:

    Specification: Semantics of a Foundation Subset for Executable UML Models, FTF – Beta 1 (ptc/08-11-03)

    Section: 8.6.2.2.1 (ActionActivation)

    Summary:

    At the end of ActionActivation::fire, a check is made to see if the action should fire again. The intent is that this should happen if the action has input pins and there are still tokens left on one or more pins after the previous firing (because there were more tokens on the pins than the multiplicity upper bound). Currently, this check is made by first checking that the action has input pins and then calling receiveOffer, so that the isReady test can check for inputs.

    However, if the action input pins, but they are all optional (i.e., multiplicity lower bound of 0), and no incoming control flows, then the action will be ready to fire whether or not there are any inputs on the pins. This will result in an infinite recursion of the action continually firing.

    Proposed resolution:

    Replace:

    // Activate the action again, if prerequisites are still satisfied (i.e., when tokens have been left on input pins).

    Debug.println("[fire] Checking if " + this.node.name + " should fire again...");

    if (((Action)(this.node)).input.size() > 0)

    { this.receiveOffer(); }

    with:

    // Activate the action again, if tokens have been left on input pins and the action has no incoming control flows.

    Debug.println("[fire] Checking if " + this.node.name + " should fire again...");

    if (((Action)(this.node)).input.size() > 0 & this.node.incoming.size() == 0) {

    boolean fireAgain = true;

    InputPinList inputPins = ((Action)(this.node)).input;

    int j = 1;

    while (fireAgain & j <= inputPins.size())

    { PinActivation inputPinActivation = this.getPinActivation(inputPins.getValue(j-1)); fireAgain = inputPinActivation.isReady() & inputPinActivation.countUnofferedTokens() > 0; j = j + 1; }

    if (fireAgain)

    { this.fire(new TokenList()); }

    }

    (Note: This code does not check for incoming control tokens, but, rather, only fires the action again if it has no incoming control flows. If an action has incoming control flows and inputs left on its input pins, then an offer on a control flow will trigger the action to fire again.)

  • Reported: FUML 1.0b1 — Tue, 20 Jan 2009 05:00 GMT
  • Disposition: Resolved — FUML 1.0b2
  • Disposition Summary:

    Change the code as proposed.

  • Updated: Fri, 6 Mar 2015 20:58 GMT