Skip to content

Commit

Permalink
Merge pull request #1371 from Phala-Network/fix-sidevm-stucks
Browse files Browse the repository at this point in the history
pRuntime: Fix sidevm stucks at restart
  • Loading branch information
kvinwang committed Aug 29, 2023
2 parents ec8ea54 + aba7eba commit 6cea02d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions crates/phala-scheduler/src/task_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ impl<TaskId: TaskIdType> TaskScheduler<TaskId> {
self.inner.lock().unwrap().poll_resume(cx, task_id, weight)
}

pub fn reset(&self, task_id: &TaskId) {
self.exit(task_id)
}

pub fn exit(&self, task_id: &TaskId) {
self.inner.lock().unwrap().exit(task_id)
}
Expand Down
4 changes: 3 additions & 1 deletion crates/sidevm/host-runtime/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ pub struct WasmRun {

impl Drop for WasmRun {
fn drop(&mut self) {
self.env.cleanup()
self.env.cleanup();
self.scheduler.exit(&self.id);
}
}

Expand Down Expand Up @@ -73,6 +74,7 @@ impl WasmRun {
env.set_instance(instance);
env.set_gas_per_breath(gas_per_breath);
env.set_weight(weight);
scheduler.reset(&id);
Ok((
WasmRun {
env: env.clone(),
Expand Down

0 comments on commit 6cea02d

Please sign in to comment.