Skip to content

Commit

Permalink
Don't log Cancelled exceptions in restorer
Browse files Browse the repository at this point in the history
Also, fix ref-counting race in test.
  • Loading branch information
talex5 committed Sep 27, 2024
1 parent 70b2a4a commit d0a8977
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions capnp-rpc-net/restorer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ let fn (r:t) =
fun k object_id ->
match r object_id with
| r -> k r
| exception (Eio.Cancel.Cancelled _ as ex) ->
k (reject Capnp_rpc.Exception.cancelled);
raise ex
| exception ex ->
Log.err (fun f -> f "Uncaught exception restoring object: %a" Fmt.exn ex);
k (reject (Capnp_rpc.Exception.v "Internal error restoring object"))
Expand Down
5 changes: 3 additions & 2 deletions test-lwt/test_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,8 @@ let test_late_bootstrap ~net =
let make_sturdy () _id = assert false
let load () _sr _name =
Promise.resolve set_connected ();
Promise.await service
Promise.await service;
Capnp_rpc_net.Restorer.grant @@ Echo.local ()
end in
let table = Capnp_rpc_net.Restorer.Table.of_loader ~sw:server_sw (module Loader) () in
let restore = Restorer.of_table table in
Expand All @@ -719,7 +720,7 @@ let test_late_bootstrap ~net =
Promise.await connected;
Eio.Cancel.protect @@ fun () ->
Switch.fail client_switch Simulated_failure;
Promise.resolve set_service @@ Capnp_rpc_net.Restorer.grant @@ Echo.local ();
Promise.resolve set_service ();
let service = Capability.await_settled service |> Result.get_error in
Logs.info (fun f -> f "client got: %a" Capnp_rpc.Exception.pp service);
assert (service.Capnp_rpc.Exception.ty = `Disconnected);
Expand Down

0 comments on commit d0a8977

Please sign in to comment.