Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 6d7aefe

Browse files
committed
remove unnecessary assertion from subtask_cancel
If the task to be cancelled is yielding or was cancelled earlier, then an event will already have been set for that task, which is normal and does not indicate a bug. Fixes #146 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 4280e78 commit 6d7aefe

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

crates/wasmtime/src/runtime/component/concurrent.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,10 @@ impl ComponentInstance {
24092409
// Started, but not yet returned or cancelled; send the
24102410
// `CANCELLED` event
24112411
task.cancel_sent = true;
2412-
assert!(task.event.is_none());
2412+
// Note that this might overwrite an event that was set earlier
2413+
// (e.g. `Event::None` if the task is yielding, or
2414+
// `Event::Cancelled` if it was already cancelled), but that's
2415+
// okay -- this should supersede the previous state.
24132416
task.event = Some(Event::Cancelled);
24142417
if let Some(set) = task.waiting_on.take() {
24152418
let item = match self.get_mut(set)?.waiting.remove(&guest_task).unwrap() {

0 commit comments

Comments
 (0)