rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

QUIC "Message too long"

Open nazar-pc opened this issue 2 years ago • 8 comments

Summary

With switch to QUIC I sometimes getting messages like this:

2023-10-14T07:49:21.668469Z sendmsg error: Os { code: 90, kind: Uncategorized, message: "Message too long" }, Transmit: { destination: 65.108.232.15:30533, src_ip: None, enc: Some(Ect0), len: 1420, segment_size: None }

Expected behavior

Should not exceed MTU

Actual behavior

Fails, likely due to exceeding MTU

Relevant log output

No response

Possible Solution

This likely happens because I have MTU set to 1420 (Wireguard is the reason) rather than more common 1500. If there is MTU expectation hardcoded somewhere it probably needs to change to MTU discovery instead. If MTU discovery is already present, it should not print warnings/errors.

Changing MTU back to 1500 resolves the issue.

Version

libp2p 0.52.3 libp2p-quic 0.9.2

Would you like to work on fixing this bug ?

Maybe

nazar-pc avatar Oct 14 '23 07:10 nazar-pc

Yeah, the default MTU of QUIC is 1500 - 28: https://docs.rs/quinn-proto/latest/src/quinn_proto/config.rs.html#517

I guess we could add a configuration flag to change this!

thomaseizinger avatar Oct 14 '23 21:10 thomaseizinger

I don't think we'll be changing it in our implementation either, it ideally needs to adjust to whatever actual MTU is when connection is established or message size when this error is hit.

nazar-pc avatar Oct 14 '23 21:10 nazar-pc

I don't think we'll be changing it in our implementation either, it ideally needs to adjust to whatever actual MTU is when connection is established or message size when this error is hit.

Is that possible? Some quick research suggests that even discovering the MTU of the local interface is not all that useful and instead you'd need to do MTU path discovery.

Seems to be much easier to start with configuring it first if you know that you'll be running over wireguard for example.

thomaseizinger avatar Oct 15 '23 06:10 thomaseizinger

@nazar-pc can you test with MtuDiscoveryConfig::default()?

https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html#method.mtu_discovery_config

Additional context, in case folks want to dive deeper: https://www.rfc-editor.org/rfc/rfc9000.html#name-datagram-size

mxinden avatar Oct 16 '23 14:10 mxinden

@nazar-pc can you test with MtuDiscoveryConfig::default()?

Isn't MtuDiscoveryConfig::default() what is used by default already though?

nazar-pc avatar Dec 13 '23 10:12 nazar-pc

@nazar-pc can you test with MtuDiscoveryConfig::default()?

Isn't MtuDiscoveryConfig::default() what is used by default already though?

From what I know, yes.

Where exactly is that log emitted? Perhaps it is an issue within quinn?

thomaseizinger avatar Jan 15 '24 01:01 thomaseizinger

Where exactly is that log emitted? Perhaps it is an issue within quinn?

It comes from quinn_udp according to this report for example.

nazar-pc avatar Jan 15 '24 01:01 nazar-pc

Where exactly is that log emitted? Perhaps it is an issue within quinn?

It comes from quinn_udp according to this report for example.

Could you investigate upstream? I am not really sure what we can do in libp2p if we are already using path MTU discovery.

thomaseizinger avatar Jan 15 '24 02:01 thomaseizinger