Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4974

try another srv-record on MongoSocketException

    • Type: Icon: Improvement Improvement
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 4.0.5
    • Component/s: Retryability
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      com.mongodb.internal.operation.OperationHelper#withReadConnectionSource could try getting another server until there are none left when opening connection fails, so the users would not get the MongoSocketException in case of mongo/mongos instances being moved

      com.mongodb.MongoSocketException: 10-232-23-30.backend-mongos-production-aux.backend-mongos.svc.hoffman2.local
          at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:211)
          at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:75)
          at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65)
          at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:127)
          at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50)
          at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:435)
          at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:117)
          at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:102)
          at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:90)
          at com.mongodb.internal.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:119)
          at com.mongodb.client.internal.ClientSessionBinding$SessionBindingConnectionSource.getConnection(ClientSessionBinding.java:135)
          at com.mongodb.internal.operation.FindOperation$1.call(FindOperation.java:628)
          at com.mongodb.internal.operation.FindOperation$1.call(FindOperation.java:625)
          at com.mongodb.internal.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:462)
          at com.mongodb.internal.operation.FindOperation.execute(FindOperation.java:625)
          at com.mongodb.internal.operation.FindOperation.execute(FindOperation.java:77)
          at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:190)
          at com.mongodb.client.internal.FindIterableImpl.first(FindIterableImpl.java:189)

            Assignee:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Reporter:
            faucct@joom.com Nikita Sokolov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: