From 779aea7c6a17b5ef5fb33cffeab1b55ce4c44915 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 6 Sep 2023 17:12:11 +0800 Subject: [PATCH] check subkernel exceptions only when awaited --- src/runtime/src/comms.rs | 16 ---------------- src/runtime/src/subkernel.rs | 34 ---------------------------------- 2 files changed, 50 deletions(-) diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index cdcb4e9e..5e01d316 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -187,22 +187,6 @@ async fn handle_run_kernel( ) -> Result<()> { control.borrow_mut().tx.async_send(kernel::Message::StartRequest).await; loop { - #[cfg(has_drtio)] - while let Some(subkernel_finished) = - subkernel::get_finished_with_exception(aux_mutex, routing_table, timer).await? - { - if subkernel_finished.status == subkernel::FinishStatus::CommLost { - error!( - "Communication with satellite lost while subkernel {} was running", - subkernel_finished.id - ); - } - if let Some(exception) = subkernel_finished.exception { - if let Some(stream) = stream { - write_chunk(stream, &exception).await?; - } - } - } let reply = control.borrow_mut().rx.async_recv().await; match reply { kernel::Message::RpcSend { is_async, data } => { diff --git a/src/runtime/src/subkernel.rs b/src/runtime/src/subkernel.rs index 2fcc7e93..3c86a59b 100644 --- a/src/runtime/src/subkernel.rs +++ b/src/runtime/src/subkernel.rs @@ -160,40 +160,6 @@ pub async fn destination_changed( } } -pub async fn get_finished_with_exception( - aux_mutex: &Rc>, - routing_table: &RoutingTable, - timer: GlobalTimer, -) -> Result, Error> { - let mut locked_subkernels = SUBKERNELS.async_lock().await; - for (id, subkernel) in locked_subkernels.iter_mut() { - match subkernel.state { - SubkernelState::Finished { - status: FinishStatus::Ok, - } => (), - SubkernelState::Finished { status } => { - subkernel.state = SubkernelState::Finished { - status: FinishStatus::Ok, - }; - return Ok(Some(SubkernelFinished { - id: *id, - status: status, - exception: if status == FinishStatus::Exception { - Some( - drtio::subkernel_retrieve_exception(aux_mutex, routing_table, timer, subkernel.destination) - .await?, - ) - } else { - None - }, - })); - } - _ => (), - } - } - Ok(None) -} - pub async fn await_finish( aux_mutex: &Rc>, routing_table: &RoutingTable,