-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to increase the max frame size? #306
Comments
Hi! Which transport/serialization protocol are you using? |
I'm using |
+1 on this question. It would be great to have some example code showing how to increase the frame size (whether for JSON or bincode). |
Sorry for another clarification -- is this via tokio-serde? The reason I ask is because it may be a question for them. I suspect that tokio-serde's bincode codec doesn't currently support modifying the frame size. |
Yes, I am just following the example code here. It looks like there is probably a way to make this work by somehow calling this function. Increasing the max frame size may not be strictly a If I figure out a clean way to increase the maximum frame size, I can submit a PR. If you know of a simple way to do it, that would be great too. |
I'll do a bit of investigation, but my hope is to do it via tokio-serde -- if you get to it before me, I'd be very thankful for a PR with an example of how to do this! |
Also encountered this. Has anyone figured out something? |
It will be possible to do this via tarpc::serde_transport::tcp::listen(addr, || {
tokio_serde::Bincode::from(
// Configure your preferred frame size here.
bincode::options()
// 2^32 bytes
.with_limit(4294967296)
)
}) Edit: I pushed a branch with an example of this. If you want to try it yourself. you'll need to modify your Cargo.toml to point to my branch of tokio-serde. |
Thanks! After overriding Client: let transport = tarpc::serde_transport::tcp::connect(
server_addr
.parse::<std::net::SocketAddr>()
.unwrap_or_else(|_| {
panic!("cannot parse server_addr {:?}", server_addr);
}),
tokio_serde::formats::Bincode::from(bincode::options().with_no_limit()),
)
.await
.unwrap();
let client = MyServiceClient::new(tarpc::client::Config::default(), transport)
.spawn()
.unwrap(); Server: tarpc::serde_transport::tcp::listen(
(std::net::IpAddr::from([0, 0, 0, 0]), config.server_port),
|| tokio_serde::formats::Bincode::from(bincode::options().with_no_limit()),
)
.await?
.filter_map(|r| futures::future::ready(r.ok()))
.map(tarpc::server::BaseChannel::with_defaults)
.map(|channel| {
let server = MyServer {
socket_addr: channel.as_ref().peer_addr().unwrap(),
};
channel.respond_with(server.serve()).execute()
})
.buffer_unordered(20)
.for_each(|_| async {})
.await; |
@tikue It seems that bincode's default byte limit is |
Ah! You're totally right. I think it's coming from the hard-coded |
Thanks :) It seems to be this line: https://github.com/google/tarpc/blob/v0.21.1/tarpc/src/serde_transport/mod.rs#L102. Not sure about where to appropriately add the method though. |
I pushed a commit to master that exposes the framing config options. I updated the example service to show how to do this. Let me know if it fixes it :) |
I'm still getting |
As far as I can tell, it's working for me locally. I can set the frame size very small and force the client requests to error, and when I set the frame size bigger, the errors stop. |
Turns out it works fines. I was still getting Thanks a lot for your help! @tikue |
Very glad to hear it's working! I'll publish a version later today. |
I just published v0.22.0 which incorporates this change. |
I have encountered the error of
ClientHandler errored out: frame size too big
, how can I increase the max frame size in tarpc?The text was updated successfully, but these errors were encountered: