Skip to content

v9.18.0: PubSub in TLS-only cluster connects to port 0 instead of TLS port #3726

@ZynovII

Description

@ZynovII

Description

After upgrading from go-redis v9.17.3 to v9.18.0, PubSub connections in a TLS-only Redis cluster (--port 0 --tls-port 6379) attempt to connect to port 0 instead of the correct TLS port 6379. Regular (non-PubSub) operations work correctly.

Error

dial tcp 172.30.0.12:0: connect: connection refused

Logged as: component=pubsub node_address=172.30.0.12:0

Environment

  • Redis 7.4.8 cluster, 6 nodes (3 masters + 3 replicas)
  • TLS-only mode: --port 0 --tls-port 6379 --tls-cluster yes
  • go-redis v9.17.3 → v9.18.0

Key observations

  1. CLUSTER SLOTS returns the correct port 6379 for all nodes
  2. CLUSTER SHARDS returns tls-port: 6379 but no port field (expected for --port 0 config)
  3. Standard Redis operations (PING, SET, GET, etc.) work fine with correct port 6379
  4. Only PubSub connections get port 0
  5. Reverting to v9.17.3 fixes the issue completely

Analysis

Compared the full diff between v9.17.3 and v9.18.0. The topology discovery via ClusterSlots() correctly returns port 6379. The issue appears to be in how PubSub connections are established in cluster mode.

Relevant changes in v9.18.0 that may contribute:

  • newClusterNodenewClusterNodeWithNodeAddress (new nodeAddress parameter)
  • New NodeAddress field in Options
  • clone() now copies pubSubPool (was missing in v9.17.3)
  • New DialTimeout (5s), DialerRetries (5) defaults in ClusterOptions.init()
  • New routing system (osscluster_router.go)

Reproduction

This was discovered through LangGraph API which upgraded go-redis from v9.17.3 (in v0.7.56) to v9.18.0 (in v0.7.60). A full reproduction environment is available in the linked LangGraph issue.

Minimal reproduction steps:

  1. Set up a 6-node Redis 7.x TLS-only cluster (--port 0 --tls-port 6379)
  2. Connect with go-redis v9.18.0 ClusterClient using rediss:// URI
  3. Standard operations work
  4. PubSub Subscribe fails with dial tcp <node-ip>:0: connection refused

Expected behavior

PubSub should connect to the TLS port (6379), same as regular operations.

Actual behavior

PubSub connects to port 0, which fails immediately.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions