Skip to content

🐞 [Bug]: RMB: Connections deduplicate not working #1404

@sameh-farouk

Description

@sameh-farouk

What happened?

There is a deduplicate logic in place for relay URLs, but it isn't working as expected.

  • We build validRelayURLs and a parallel connections slice.
  • Then sort+compact validRelayURLs, but we create the connections from the uncompact list. If the same relay host is provided multiple times, connections end up with duplicates.
  • Later Start() is called for each connection, so we see two “connecting” logs for the same relay.
  • Starting duplicate connections will force the relay to drop the previous one to keep one connection per session ID, causing a reconnect spam and error 1006 (abnormal closure) that reflects relay rejection and connection self-heal logic.

Relevant log output

{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:23+03:00","message":"connecting"}
{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:23+03:00","message":"connecting"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:24+03:00","message":"failed to read message"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:24+03:00","message":"failed to read message"}
{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:26+03:00","message":"connecting"}
{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:26+03:00","message":"connecting"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:26+03:00","message":"failed to read message"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:26+03:00","message":"failed to read message"}
{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:28+03:00","message":"connecting"}
{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:28+03:00","message":"connecting"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:28+03:00","message":"failed to read message"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:28+03:00","message":"failed to read message"}
{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:30+03:00","message":"connecting"}
{"level":"debug","url":"wss://relay.dev.grid.tf","time":"2025-08-10T20:34:30+03:00","message":"connecting"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:30+03:00","message":"failed to read message"}
{"level":"debug","error":"websocket: close 1006 (abnormal closure): unexpected EOF","time":"2025-08-10T20:34:30+03:00","message":"failed to read message"}

Metadata

Metadata

Assignees

Labels

type_bugSomething isn't working

Type

Projects

Status

Pending Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions