We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4838053 commit 401cc43Copy full SHA for 401cc43
1 file changed
sled-agent/src/sim/collection.rs
@@ -221,7 +221,13 @@ impl<S: Simulatable + 'static> SimCollection<S> {
221
/// any further state changes for it.
222
pub async fn sim_force_remove(&self, id: Uuid) {
223
let mut objects = self.objects.lock().await;
224
- let object = objects.remove(&id).unwrap();
+ // The object may already have been destroyed and removed by a
225
+ // concurrent `sim_poke` (e.g., a background `sim_step` racing with
226
+ // an explicit `instance_unregister`). In that case there is
227
+ // nothing left to do.
228
+ let Some(object) = objects.remove(&id) else {
229
+ return;
230
+ };
231
if let Some(mut tx) = object.channel_tx {
232
tx.close_channel();
233
}
0 commit comments