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
- CLUSTER SLOTS returns the correct port 6379 for all nodes
- CLUSTER SHARDS returns
tls-port: 6379 but no port field (expected for --port 0 config)
- Standard Redis operations (PING, SET, GET, etc.) work fine with correct port 6379
- Only PubSub connections get port 0
- 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:
newClusterNode → newClusterNodeWithNodeAddress (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:
- Set up a 6-node Redis 7.x TLS-only cluster (
--port 0 --tls-port 6379)
- Connect with go-redis v9.18.0
ClusterClient using rediss:// URI
- Standard operations work
- 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.
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
Logged as:
component=pubsub node_address=172.30.0.12:0Environment
--port 0 --tls-port 6379 --tls-cluster yesKey observations
tls-port: 6379but noportfield (expected for--port 0config)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:
newClusterNode→newClusterNodeWithNodeAddress(newnodeAddressparameter)NodeAddressfield inOptionsclone()now copiespubSubPool(was missing in v9.17.3)DialTimeout(5s),DialerRetries(5) defaults inClusterOptions.init()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:
--port 0 --tls-port 6379)ClusterClientusingrediss://URIdial tcp <node-ip>:0: connection refusedExpected behavior
PubSub should connect to the TLS port (6379), same as regular operations.
Actual behavior
PubSub connects to port 0, which fails immediately.