Repair nested-panic situation

This commit is contained in:
Tony Garnock-Jones 2024-03-29 10:23:21 +01:00
parent 8a817fcb4f
commit 9084c1781e
1 changed files with 10 additions and 1 deletions

View File

@ -1837,7 +1837,16 @@ impl Activation {
) {
match &*exit_status {
ExitStatus::Normal => assert!(self.get_facet(self.root).is_none()),
ExitStatus::Dropped | ExitStatus::Error(_) => (),
ExitStatus::Dropped => {
// If we panicked, facet_id will be Some(_), but leaving it this way as we
// enter take_turn causes a nested panic, so we clear it here.
if self.facet_id.is_some() {
tracing::debug!(actor_id=?self.actor_id, facet_id=?self.facet_id,
"clearing facet_id (we must have panicked mid-Turn)");
self.facet_id = None;
}
}
ExitStatus::Error(_) => (),
}
let cause = Some(trace::TurnCause::Cleanup);