Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.
This repository was archived by the owner on May 26, 2022. It is now read-only.

Yamux v2.1.0 broke libp2p compat #36

Closed
@Stebalien

Description

@Stebalien

It introduces a new InitialStreamWindowSize config entry to set the initial stream window size. Unfortunately:

  1. This (and MaxStreamWindowSize) affect both our receive windows and our initial send window.
  2. This isn't something that we negotiate anywhere.
  3. 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.

  1. It sounds like we need to set the InitialStreamWindowSize to 16MiB. This is... unfortunate, but not terrible.
  2. 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:

  1. We're adjusting defaults here instead of setting them down in go-yamux. That means our go-yamux tests won't catch issues here.
  2. 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.
  3. We're not performing interop tests here. We do have interop tests, but they're all mplex based and only work go<->js.

Metadata

Metadata

Labels

P0Critical: Tackled by core team ASAPeffort/hoursEstimated to take one or several hoursexp/intermediatePrior experience is likely helpfulkind/bugA bug in existing code (including security flaws)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions