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

Java Spring Reactive cannot connect to server

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.0
    • Component/s: Reactive Streams
    • None

      I would like to get a confirmation and explanation of the root cause of this error below

      The Error from mongo : 

      1. Mongo Socket Error when Write

      Something went wrong org.springframework.dao.DataAccessResourceFailureException: Exception sending message; nested exception is }}com.mongodb.MongoSocketWriteException{{{}: Exception sending message at {}
      -------------------------------------------------------------------

      2. Mongo Socket Error when Read
      com.mongodb.MongoSocketReadException: Prematurely reached end of stream
      -------------------------------------------------------------------

      3. Follow by no Server chosen

      org.mongodb.driver.cluster : No server chosen by com.mongodb.reactivestreams.client.internal.ClientSessionHelper$$Lambda$0000/0x0000000840bf7440@3fcda9a9 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=xxx-dev-xxx-documentdb-0.xxxxxx-xxxxxx.docdb.amazonaws.com:27000, type=UNKNOWN, state=CONNECTING, exception=

      {com.mongodb.MongoSocketWriteException: Exception sending message}

      , caused by {io.netty.channel.StacklessClosedChannelException}}]}. Waiting for 30000 ms before timing out

      Is the root cause can be put as consumption below? and Solution to putting maxIdleTime is correct?

      Root caused : 

      When the connection is idle for a period of time, the connection is closed due to firewall or load balancing, and the client does not know that, when the client continues to use this closed connection for reading and writing, an error will occur.

      If the root cause and solution correct? Is there another way we can see that the connection is lost? In the log, I only see the connection is Open

        1. MongoErrorLog.rtf
          15 kB
        2. mongoKibana.png
          mongoKibana.png
          1.49 MB
        3. Screen Shot 2565-10-11 at 14.06.45.png
          Screen Shot 2565-10-11 at 14.06.45.png
          734 kB
        4. Solution.png
          Solution.png
          665 kB

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            tanya.chansataporn@gmail.com Tanya C
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: