Skip to content

Commit

Permalink
Merge pull request #5917 from oasisprotocol/peternose/bugfix/rpc-clie…
Browse files Browse the repository at this point in the history
…nt-panic

runtime/src/enclave_rpc/client: Fix panic on drop in async context
  • Loading branch information
peternose authored Oct 22, 2024
2 parents a950040 + cd0f3be commit 013c51e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changelog/5917.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
runtime/src/enclave_rpc/client: Fix panic on drop in async context

The graceful shutdown of active sessions was removed, as they should
not be closed when the RPC client is dropped. Instead, we should
explicitly invoke the appropriate functions.
14 changes: 0 additions & 14 deletions runtime/src/enclave_rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use crate::{
time::insecure_posix_time,
},
enclave_rpc::{session::Builder, types},
future::block_on,
protocol::Protocol,
};

Expand Down Expand Up @@ -623,19 +622,6 @@ impl RpcClient {
}
}

impl Drop for RpcClient {
fn drop(&mut self) {
// Close all sessions after the client is dropped.
block_on(async {
let sessions = {
let mut sessions = self.sessions.lock().await;
sessions.drain()
};
self.close_all(sessions).await;
});
}
}

#[cfg(test)]
mod test {
use std::sync::{
Expand Down

0 comments on commit 013c51e

Please sign in to comment.