Skip to content

Race condition when dialing peer and opening a substream #504

@dmitry-markin

Description

@dmitry-markin

If we dial an address and then try to open a substream on LiteP2pEvent::ConnectionEstablished, opening a substream fails ~30% of time.

Timeline:
T0: litep2p.dial_address(address).await
T1: Litep2pEvent::ConnectionEstablished received
T2: self.service.open_substream(peer) — fails with error=PeerDoesNotExist
T3: self.service.dial(peer) — reports AlreadyConnected
T4: self.service.open_substream(peer) — fails for a second time with error=PeerDoesNotExist

Discovered while working on #501.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions