diff --git a/comms/core/src/protocol/rpc/mod.rs b/comms/core/src/protocol/rpc/mod.rs index cc221868d6..ba5ba2a4d2 100644 --- a/comms/core/src/protocol/rpc/mod.rs +++ b/comms/core/src/protocol/rpc/mod.rs @@ -30,7 +30,7 @@ mod test; /// Maximum frame size of each RPC message. This is enforced in tokio's length delimited codec. /// This can be thought of as the hard limit on message size. -pub const RPC_MAX_FRAME_SIZE: usize = 3 * 1024 * 1024; // 3 MiB +pub const RPC_MAX_FRAME_SIZE: usize = 4 * 1024 * 1024; // 4 MiB /// The maximum size for a single RPC response message pub const RPC_MAX_RESPONSE_SIZE: usize = 4 * 1024 * 1024; // 4 MiB @@ -39,7 +39,7 @@ const fn max_request_size() -> usize { RPC_MAX_FRAME_SIZE } -/// The maximum size for a single RPC response excluding overhead +/// The maximum size for a single RPC response body excluding response header overhead const fn max_response_payload_size() -> usize { // RpcResponse overhead is: // - 4 varint protobuf fields, each field ID is 1 byte @@ -47,7 +47,7 @@ const fn max_response_payload_size() -> usize { // - 1 length varint for the payload, allow for 5 bytes to be safe (max_payload_size being technically too small is // fine, being too large isn't) const MAX_HEADER_SIZE: usize = 4 + 4 * 5; - RPC_MAX_RESPONSE_SIZE - MAX_HEADER_SIZE + RPC_MAX_FRAME_SIZE - MAX_HEADER_SIZE } mod body; diff --git a/comms/core/src/protocol/rpc/test/smoke.rs b/comms/core/src/protocol/rpc/test/smoke.rs index 51c2471593..77697d272e 100644 --- a/comms/core/src/protocol/rpc/test/smoke.rs +++ b/comms/core/src/protocol/rpc/test/smoke.rs @@ -279,10 +279,11 @@ async fn concurrent_requests() { #[tokio::test] async fn response_too_big() { + env_logger::builder().filter_level(log::LevelFilter::Debug).init(); let (_inbound, outbound, _, _, _shutdown) = setup(GreetingService::new(&[]), 1).await; let socket = outbound.get_yamux_control().open_stream().await.unwrap(); - let framed = framing::canonical(socket, rpc::RPC_MAX_RESPONSE_SIZE); + let framed = framing::canonical(socket, rpc::max_request_size()); let mut client = GreetingClient::builder() .with_deadline(Duration::from_secs(5)) .connect(framed)