<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/15896">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fsm: refuse state chg and events after term<br><br>Refuse state changes and event dispatch for FSM instances that are already<br>terminating.<br><br>It is assumed that refusing state changes and events after FSM termination is<br>seen as the sane expected behavior, hence this change in behavior is merged<br>without being configurable.<br><br>There is no fallout in current Osmocom code trees. fsm_dealloc_test needs a<br>changed expected output, since it is explicitly creating complex FSM structures<br>that terminate. Currently no other C test in Osmocom code needs adjusting.<br><br>Rationale:<br><br>Where multiple FSM instances are collaborating (like in osmo-bsc or osmo-msc),<br>a terminating FSM instance often causes events to be dispatched back to itself,<br>or causes state changes in FSM instances that are already terminating. That is<br>hard to avoid, since each FSM instance could be a cause of failure, and wants<br>to notify all the others of that, which in turn often choose to terminate.<br><br>Another use case: any function that dispatches events or state changes to more<br>than one FSM instance must be sure that after the first event dispatch, the<br>second FSM instance is in fact still allocated. Furthermore, if the second FSM<br>instance *has* terminated from the first dispatch, this often means that no<br>more actions should be taken. That could be done by an explicit check for<br>fsm->proc.terminating, but a more general solution is to do this check<br>internally in fsm.c.<br><br>In practice, I need this to avoid a crash in libosmo-mgcp-client, when an<br>on_success() event dispatch causes the MGCP endpoint FSM to deallocate. The<br>earlier dealloc-in-main-loop patch fixed part of it, but not all.<br><br>Change-Id: Ia81a0892f710db86bd977462730b69f0dcc78f8c<br>---<br>M src/fsm.c<br>M tests/fsm/fsm_dealloc_test.err<br>2 files changed, 307 insertions(+), 1,996 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/15896">change 15896</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/15896"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia81a0892f710db86bd977462730b69f0dcc78f8c </div>
<div style="display:none"> Gerrit-Change-Number: 15896 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>