[Bug] EOTS Staking function has a mongodb timeout bug

Server Selection Timeout and Connection Errors in MongoDB Replica Set


We are encountering an INTERNAL_SERVICE_ERROR during operations, which seems to be caused by a server selection timeout within our MongoDB replica set. The error message indicates issues with server selection, connection timeouts, and an inability to find a specified host within the replica set topology.

Error Message

  "message": "server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: mongodb-0.mongodb-headless.mongodb.svc.cluster.local:27017, Type: Unknown, Last error: connection(mongodb-0.mongodb-headless.mongodb.svc.cluster.local:27017[-2440]) incomplete read of message header: read tcp> i/o timeout }, { Addr: mongodb-1.mongodb-headless.mongodb.svc.cluster.local:27017, Type: Unknown, Last error: connection(mongodb-1.mongodb-headless.mongodb.svc.cluster.local:27017[-2441]) incomplete read of message header: read tcp> i/o timeout }, { Addr: mongodb-2.mongodb-headless.mongodb.svc.cluster.local:27017, Type: Unknown, Last error: dial tcp: lookup mongodb-2.mongodb-headless.mongodb.svc.cluster.local: no such host }, { Addr: mongodb-arbiter-0.mongodb-arbiter-headless.mongodb.svc.cluster.local:27017, Type: RSArbiter, Average RTT: 11586684 }, ] }"

Steps to Reproduce

  1. Attempt to connect to the MongoDB replica set or perform operations that require server selection.
  2. Observe the error response.

Expected Behavior

The MongoDB client should successfully connect to an available server within the replica set without experiencing timeouts or host resolution issues.

Actual Behavior

The connection attempts result in a server selection timeout, including errors related to incomplete reads of message headers due to I/O timeouts and a failure to resolve one of the host addresses.


  • MongoDB
  • Deployment environment: Kubernetes
  • Cluster configuration: ReplicaSet with at least 3 nodes and an arbiter.

Additional Context

  • The network connectivity between the client and all MongoDB servers should be verified to ensure there are no underlying network issues.
  • DNS resolution for the MongoDB service endpoints within the Kubernetes cluster should also be checked.