java.lang.RuntimeException: org.mongodb.MongoInternalException: Unexpected runtime exception

JIRA | Andre Spiegel | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I have a Java program that is using multiple threads to write to a stand-alone 2.6.0 server. Documents are about 1.6k each. When using a low batch size (1 or 2) and 6-8 threads, the application gets the below exception after a few minutes of writing to the database: {noformat} Exception in thread "Thread-8" 03:29:12.876 [Thread-11] INFO org.mongodb.driver.cluster - No server chosen by PrimaryServerSelector from cluster description ClusterDescription{t ype=UNKNOWN, connectionMode=SINGLE, all=[ServerDescription{address=century-standalone:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 29999 ms before timing out 03:29:12.876 [Thread-9] INFO org.mongodb.driver.cluster - No server chosen by PrimaryServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SING LE, all=[ServerDescription{address=century-standalone:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 29999 ms before timing out java.lang.RuntimeException: org.mongodb.MongoInternalException: Unexpected runtime exception at net.drmirror.DataLoader$Loader.loadFile(DataLoader.java:183) at net.drmirror.DataLoader$PoolLoader.run(DataLoader.java:208) Caused by: org.mongodb.MongoInternalException: Unexpected runtime exception at org.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:125) at org.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:73) at org.mongodb.connection.PooledConnectionProvider$PooledConnection.receiveMessage(PooledConnectionProvider.java:245) at org.mongodb.connection.DefaultServer$DefaultServerConnection.receiveMessage(DefaultServer.java:167) at org.mongodb.protocol.WriteCommandProtocol.receiveMessage(WriteCommandProtocol.java:112) at org.mongodb.protocol.WriteCommandProtocol.execute(WriteCommandProtocol.java:70) at org.mongodb.protocol.InsertCommandProtocol.execute(InsertCommandProtocol.java:55) at org.mongodb.protocol.WriteCommandProtocol.execute(WriteCommandProtocol.java:1) at org.mongodb.operation.OperationHelper.executeProtocol(OperationHelper.java:89) at org.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:79) at org.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:1) at org.mongodb.MongoClientImpl.execute(MongoClientImpl.java:121) at org.mongodb.MongoCollectionImpl.execute(MongoCollectionImpl.java:160) at org.mongodb.MongoCollectionImpl$MongoCollectionView.insert(MongoCollectionImpl.java:332) at org.mongodb.MongoCollectionImpl.insert(MongoCollectionImpl.java:82) at net.drmirror.DataLoader$Loader.insert(DataLoader.java:156) at net.drmirror.DataLoader$Loader.loadFile(DataLoader.java:179) ... 1 more Caused by: java.lang.IllegalStateException: This really shouldn't happen with such a long timeout at org.mongodb.operation.SingleResultFuture.get(SingleResultFuture.java:111) at org.mongodb.connection.AsynchronousSocketChannelStream.read(AsynchronousSocketChannelStream.java:57) at org.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:191) at org.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:110) ... 17 more {noformat} This does not seem to occur when the batch size is larger or less threads are used.

    JIRA | 3 years ago | Andre Spiegel
    java.lang.RuntimeException: org.mongodb.MongoInternalException: Unexpected runtime exception

    Root Cause Analysis

    1. java.lang.IllegalStateException

      This really shouldn't happen with such a long timeout

      at org.mongodb.operation.SingleResultFuture.get()
    2. org.mongodb.operation
      SingleResultFuture.get
      1. org.mongodb.operation.SingleResultFuture.get(SingleResultFuture.java:111)
      1 frame
    3. org.mongodb.connection
      DefaultServer$DefaultServerConnection.receiveMessage
      1. org.mongodb.connection.AsynchronousSocketChannelStream.read(AsynchronousSocketChannelStream.java:57)
      2. org.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:191)
      3. org.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:110)
      4. org.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:73)
      5. org.mongodb.connection.PooledConnectionProvider$PooledConnection.receiveMessage(PooledConnectionProvider.java:245)
      6. org.mongodb.connection.DefaultServer$DefaultServerConnection.receiveMessage(DefaultServer.java:167)
      6 frames
    4. org.mongodb.protocol
      WriteCommandProtocol.execute
      1. org.mongodb.protocol.WriteCommandProtocol.receiveMessage(WriteCommandProtocol.java:112)
      2. org.mongodb.protocol.WriteCommandProtocol.execute(WriteCommandProtocol.java:70)
      3. org.mongodb.protocol.InsertCommandProtocol.execute(InsertCommandProtocol.java:55)
      4. org.mongodb.protocol.WriteCommandProtocol.execute(WriteCommandProtocol.java:1)
      4 frames
    5. org.mongodb.operation
      BaseWriteOperation.execute
      1. org.mongodb.operation.OperationHelper.executeProtocol(OperationHelper.java:89)
      2. org.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:79)
      3. org.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:1)
      3 frames
    6. org.mongodb
      MongoCollectionImpl.insert
      1. org.mongodb.MongoClientImpl.execute(MongoClientImpl.java:121)
      2. org.mongodb.MongoCollectionImpl.execute(MongoCollectionImpl.java:160)
      3. org.mongodb.MongoCollectionImpl$MongoCollectionView.insert(MongoCollectionImpl.java:332)
      4. org.mongodb.MongoCollectionImpl.insert(MongoCollectionImpl.java:82)
      4 frames
    7. net.drmirror
      DataLoader$PoolLoader.run
      1. net.drmirror.DataLoader$Loader.insert(DataLoader.java:156)
      2. net.drmirror.DataLoader$Loader.loadFile(DataLoader.java:179)
      3. net.drmirror.DataLoader$PoolLoader.run(DataLoader.java:208)
      3 frames