Skip to content

Feat: Implement clean, graceful shutdown for RMB Peer #1408

@sameh-farouk

Description

@sameh-farouk

Is your feature request related to a problem? Please describe

Implement a graceful shutdown for rmb-sdk-go/peer so all relay connection goroutines and the processing loop exit cleanly without races, leaks, or panics.

  • Avoid closing shared channels (which may lead to race/panic).
  • Proactively send WebSocket close handshake to reduce protocol errors (observed in the relay-side logs).
  • Close Substrate connection

Motivation

  • goleak report goroutines like:
    - net.(*sysDialer).dialParallel (from websocket dial)
    • gethrpc.(*Client).dispatch (substrate client reader)
  • Some practice in the code noticed that it risked race conditions due to unsafe channel closes and could leave goroutines running
  • Websocket “connection reset without closing handshake” errors on the relay-side logs on shutdown of the peer.

Describe the solution you'd like

NA

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Pending Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions