Skip to content

Commit 6cea02d

Browse files
authored
Merge pull request #1371 from Phala-Network/fix-sidevm-stucks
pRuntime: Fix sidevm stucks at restart
2 parents ec8ea54 + aba7eba commit 6cea02d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

crates/phala-scheduler/src/task_scheduler.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ impl<TaskId: TaskIdType> TaskScheduler<TaskId> {
3737
self.inner.lock().unwrap().poll_resume(cx, task_id, weight)
3838
}
3939

40+
pub fn reset(&self, task_id: &TaskId) {
41+
self.exit(task_id)
42+
}
43+
4044
pub fn exit(&self, task_id: &TaskId) {
4145
self.inner.lock().unwrap().exit(task_id)
4246
}

crates/sidevm/host-runtime/src/run.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ pub struct WasmRun {
2424

2525
impl Drop for WasmRun {
2626
fn drop(&mut self) {
27-
self.env.cleanup()
27+
self.env.cleanup();
28+
self.scheduler.exit(&self.id);
2829
}
2930
}
3031

@@ -73,6 +74,7 @@ impl WasmRun {
7374
env.set_instance(instance);
7475
env.set_gas_per_breath(gas_per_breath);
7576
env.set_weight(weight);
77+
scheduler.reset(&id);
7678
Ok((
7779
WasmRun {
7880
env: env.clone(),

0 commit comments

Comments
 (0)