Skip to content

Commit

Permalink
test(qe): don't crash in rpc thread if request future was dropped (#4276
Browse files Browse the repository at this point in the history
)

Don't crash in the RPC thread in external process executor if the
receiver side of the oneshot channel was already dropped from the other
side. This may happen if the request future is dropped without polling
it to completion after the point in time where a `MethodCall` is already
sent over `task_handle` MPSC channel.
  • Loading branch information
aqrln authored Sep 25, 2023
1 parent 571a521 commit 3eac23c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ fn start_rpc_thread(mut receiver: mpsc::Receiver<ReqImpl>) -> Result<()> {
let sender = pending_requests.remove(response.id()).unwrap();
match response {
jsonrpc_core::Output::Success(success) => {
sender.send(success.result).unwrap();
// The other end may be dropped if the whole
// request future was dropped and not polled to
// completion, so we ignore send errors here.
_ = sender.send(success.result);
}
jsonrpc_core::Output::Failure(err) => {
panic!("error response from jsonrpc: {err:?}")
Expand Down

0 comments on commit 3eac23c

Please sign in to comment.