tokio-serde
tokio-serde copied to clipboard
Fails on large software
I have a large client-server software where the messages are encoded and decoded through bincode
and may contain a bunch of strings, integers, floats, etc.
I recently tried to move to tokio
which simplifies and fixes portability bugs (random os error 35 on macOS for example). To move the code I've used tokio-serde
to support deserializing the packets serialize through bincode
. Unfortunately, every-time a packet contains a bunch of strings tokio-serde
errors with "frame size too big".
Is there any workaround to this bug?
If you using LengthDelimitedCodec
then default value of max_frame_length
is 8MB so everything above 8MB in size will get rejected with that message.
Use LengthDelimitedCodec::builder()
and set your desired max_frame_length
on it, like so:
let len_codec = LengthDelimitedCodec::builder()
.max_frame_length(8 * 1024 * 1024) // 8MB
.new_codec();