Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gossipsub): gracefully disable handler on stream errors #3625

Merged
merged 42 commits into from
Apr 14, 2023

Commits on Mar 17, 2023

  1. Gossipsub: remove ConnectionHandlerEvent::Close

    Victor Ermolaev committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    1264345 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2023

  1. Move error handling closer to the source.

    Victor Ermolaev committed Mar 18, 2023
    Configuration menu
    Copy the full SHA
    3c2fbce View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2023

  1. Address PR comments.

    Victor Ermolaev committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    b8fed53 View commit details
    Browse the repository at this point in the history
  2. Address PR comments.

    Victor Ermolaev committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    f4cfbc3 View commit details
    Browse the repository at this point in the history
  3. Address PR comments.

    Victor Ermolaev committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    e7e96ed View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e37ba58 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b6be9ce View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2023

  1. Configuration menu
    Copy the full SHA
    1e06367 View commit details
    Browse the repository at this point in the history
  2. Update changelog.

    Victor Ermolaev committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    415f648 View commit details
    Browse the repository at this point in the history
  3. Fix typo in changelog

    thomaseizinger authored Mar 22, 2023
    Configuration menu
    Copy the full SHA
    f87949d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9e12f9d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ee6cb02 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3443a69 View commit details
    Browse the repository at this point in the history
  7. Flatten match

    thomaseizinger committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    fef9751 View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2023

  1. Configuration menu
    Copy the full SHA
    7dec223 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3163213 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e28af53 View commit details
    Browse the repository at this point in the history

Commits on Mar 29, 2023

  1. Track # of outbound streams requested, not successfully established

    The GossipSub protocol uses two streams, namely one from the local to the remote and one from the
    remote to the local node. The rust-libp2p implementation enforces an upper limit on the churn of
    both via `MAX_SUBSTREAM_CREATION`.
    
    Thus far `self.outbound_substreams_created` was increased for every successful stream, but ignored
    failed streams. Thus, on a given connection, a GossipSub handler could potentially indefinitely
    retry creating an outbound stream, where each of those streams fails instead of succeeds to upgrade.
    
    With this commit the handler tracks the number of requested outbound streams instead.
    mxinden committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    0507493 View commit details
    Browse the repository at this point in the history
  2. Re-enqueue message when outbound stream fails

    An outbound stream carries the first message for the remote node when upgrading in the
    `OutboundOpenInfo`. Thus far the GossipSub handler would drop the message when the outbound stream
    fails to upgrade.
    
    This could e.g. lead to a remote peer receiving a GRAFT without a previous SUBSCRIBE.
    
    With this commit the message carried in the upgrade's `OutboundOpenInfo` is re-enqueued.
    mxinden committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    b572895 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    12e9b53 View commit details
    Browse the repository at this point in the history
  4. Only send messages in poll

    Instead of popping messages early and having to re-queue them on error,
    we can remove the use of `OutboundOpenInfo` and only send messages
    in one place.
    thomaseizinger committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    fd4958d View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2023

  1. Configuration menu
    Copy the full SHA
    44dce05 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2023

  1. Configuration menu
    Copy the full SHA
    6a5f1d0 View commit details
    Browse the repository at this point in the history
  2. Move changelog entry

    thomaseizinger committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    3432ac0 View commit details
    Browse the repository at this point in the history
  3. Bump version

    thomaseizinger committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    db59d23 View commit details
    Browse the repository at this point in the history
  4. Change log level to warn for bad events

    Hitting the max substream creation means something bad is happening.
    This is worth reporting as `warn`.
    thomaseizinger committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    b94ec28 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c5e3c41 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2023

  1. Use exhaustive match

    thomaseizinger committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    c02a3a3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e94c2c7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a7ed378 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2023

  1. Configuration menu
    Copy the full SHA
    798ef5c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bbdf8f5 View commit details
    Browse the repository at this point in the history
  3. Update Cargo.lock

    mxinden committed Apr 5, 2023
    Configuration menu
    Copy the full SHA
    af21589 View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2023

  1. Refactor keep alive mechanism

    - Split handler into `EnabledHandler` and `DisabledHandler`, reducing the amount of potential state
    variants (e.g. protocol-not-supported but keep-alive-yes) and enforce the possible states at compile time.
    
    - Return `DeniedUpgrade` when handler is disabled (i.e. `DisabledHandler`).
    
    - Don't update `KeepAlive` across all handler methods, but instead derive it ad-hoc in
    `ConnectionHandler::connection_keep_alive()` based on the state of the handler. Again reduces number
    of possible invalid states at compile time.
    
    - Remove INITIAL_KEEP_ALIVE. The default idle timeout is 120s. This should be plenty enough time to
    establish in and outbound streams.
    mxinden committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    f999f3e View commit details
    Browse the repository at this point in the history
  2. Do minor clean up

    mxinden committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    397afa2 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'master' of https://github.com/libp2p/rust-libp2p into d…

    …eprecate/gossipsub-close-event
    mxinden committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    9f44adc View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b01e86f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    552cb08 View commit details
    Browse the repository at this point in the history
  6. Update swarm/CHANGELOG.md

    Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
    mxinden and thomaseizinger authored Apr 6, 2023
    Configuration menu
    Copy the full SHA
    b42e71e View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2023

  1. Configuration menu
    Copy the full SHA
    a958b60 View commit details
    Browse the repository at this point in the history

Commits on Apr 12, 2023

  1. Configuration menu
    Copy the full SHA
    d673ed2 View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2023

  1. Configuration menu
    Copy the full SHA
    7cb4e41 View commit details
    Browse the repository at this point in the history