Skip to content

Node hangs on shutdown when a peer connects after stop is signalled #89

Description

@pzafonte

If the peer thread finishes connecting after the shutdown flag is set, it misses the flag and blocks in the read loop until the 60s p2p read timeout instead of exiting. Shows up in CI as intermittent node did not exit within 45s after stop.

Set up a mock peer that holds the handshake open until stop, then completes it -> here

INFO  net   Connected to Address { ... }
INFO  node  DBG net: connected, stored writer, running=false
panicked: node did not exit within 20s

running is already false when the thread finishes connecting, but nothing between the handshake and the read loop re-checks it.

I believe the expected behavior should be every worker observes the flag and exits within ~1–2s regardless of connection timing.

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