Yamux v2.1.0 broke libp2p compat #36
Description
It introduces a new InitialStreamWindowSize
config entry to set the initial stream window size. Unfortunately:
- This (and
MaxStreamWindowSize
) affect both our receive windows and our initial send window. - This isn't something that we negotiate anywhere.
- If a peer has an initial send window that's too high, the peer will disconnect due to protocol violation.
This affects us here because this library sets the MaxStreamWindowSize
to 16MiB. That means, before we updated to Yamux v2.1.0, the initial send & receive window was 16MiB. After v2.1.0, this is the max window and the initial one is set to InitialStreamWindowSize
(16KiB). That means an old libp2p node will try to send up to 16MiB of data, while a new node will reset the stream after 16KiB.
- It sounds like we need to set the
InitialStreamWindowSize
to 16MiB. This is... unfortunate, but not terrible. - We might as well increase the maximum window size...
In the future, it would be nice to have a protocol extension where both sides could try to raise the initial stream window size.
Also note: I attempted to fix this issue by setting InitialStreamWindowSize
to 16MiB but something still didn't work... I'm not sure what, but there needs to be more investigation (cc @dirkmc)
Testing: This should have been caught by tests. Why not? Well:
- We're adjusting defaults here instead of setting them down in go-yamux. That means our go-yamux tests won't catch issues here.
I have no idea why this isn't showing up in our other tests, but the likely answer is that we're just sending around really small files/blocks. We need better stress tests.- We're not performing interop tests here. We do have interop tests, but they're all mplex based and only work go<->js.