delayed transitions - sequencer issue

Issue #35 closed
Amy Roberts created an issue

When using the sequencer to stop runs which use a deferred transition, the sequencer fails with a "Cannot stop run: ..." error. This issue is also noted in elog entry 1133.

Checking for the "CM_DEFERRED_TRANSITION" case in the first-pass block of the 'Stop' code in sequencer.cxx is one way to solve the problem - though there may well be better solutions.

My edited portion of sequencer.cxx is below. (Look for the "do nothing" comments to see what I've added.) Is this an acceptable solution that could be introduced to the master branch?

{
    // ...
} else if (equal_ustring(mxml_get_value(pn), "Stop")) {
    if (!seq.transition_request) {
       seq.transition_request = TRUE;
       size = sizeof(state);
       db_get_value(hDB, 0, "/Runinfo/State", &state, &size, TID_INT, FALSE);
       if (state != STATE_STOPPED) {
          status = cm_transition(TR_STOP, 0, str, sizeof(str), TR_MTHREAD |
TR_SYNC, TRUE);
          if (status == CM_DEFERRED_TRANSITION) {
             // do nothing
          } else if (status != CM_SUCCESS) {
             sprintf(str, "Cannot stop run: %s", str);
             seq_error(str);
          }
       }
    } else {
       // Wait until transition has finished
       size = sizeof(state);
       db_get_value(hDB, 0, "/Runinfo/State", &state, &size, TID_INT, FALSE);
       if (state == STATE_STOPPED) {
          seq.transition_request = FALSE;

          if (seq.stop_after_run) {
             seq.stop_after_run = FALSE;
             seq.running = FALSE;
             seq.finished = TRUE;
             cm_msg(MTALK, "sequencer", "Sequencer is finished.");
          } else
             seq.current_line_number++;

          db_set_record(hDB, hKeySeq, &seq, sizeof(seq), 0);
       } else {
         // do nothing
       }
    }
}

Comments (3)

  1. Amy Roberts reporter

    I've submitted my suggested fix for this bug as pull request #2: manage case: deferred transition on stop in seqencer.cxx.

    Note that this code suggestion does not fix other sequencer issues with delayed transitions (e.g., delayed start transitions).

  2. Log in to comment