libp2p / rust-yamux

Multiplexer over reliable, ordered connections.
Apache License 2.0
179 stars 43 forks source link

buffer of stream grows beyond limit #188

Open nazar-pc opened 5 months ago

nazar-pc commented 5 months ago

After upgrading to newer release of yamux with https://github.com/libp2p/rust-yamux/pull/176 I get frequent reports from users that they see errors like this in logs:

ERROR yamux::connection: 5dadd7e9/87: buffer of stream grows beyond limit

Yamux in libp2p is configured with 256 max streams and receiving window of 1310816 bytes.

Everything else is set to defaults.

Is this a known issue or maybe configuration is wrong on my end?

mxinden commented 5 months ago

Thanks for reporting @nazar-pc.

Can you reference the concrete rust-yamux version and link to your code using rust-yamux?

nazar-pc commented 5 months ago

We're using yamux 0.13.2 through libp2p-yamux 0.45.1, both of them are releases on crates.io, here is the configuration of it: https://github.com/subspace/subspace/blob/d159452bf4cd480837770d83c4f0cab3a28da048/crates/subspace-networking/src/constructor.rs#L306-L310

mxinden commented 5 months ago

Do you see the same error without:

        yamux_config.set_receive_window_size(YAMUX_RECEIVING_WINDOW as u32);
nazar-pc commented 5 months ago

Will give it a try, but since I don't see it myself will have to ask users to test a custom build without it. The default seems unnecessarily large though.

nazar-pc commented 5 months ago

According to a single user's feedback issue disappeared once I removed it

mxinden commented 5 months ago

Note that without setting the configuration option, you are using the newer yamux version, i.e. v0.13:

https://github.com/libp2p/rust-libp2p/blob/a8888a7978f08ec9b8762207bf166193bf312b94/muxers/yamux/src/lib.rs#L339-L351

With v0.13 the buffer limit is managed at the connection level, no longer at the stream level.

In other words, the fact that users no longer see the log line when removing the configuration set_receive_window_size, hints at the bug being in v0.12 and not in v0.13.

nazar-pc commented 5 months ago

Hm... but we are not setting options to fall back to 0.12 :thinking: Can 0.12 on the other end of the connection cause this?