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

Timeout while writing from multiple threads

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Performance
    • None

    Description

      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:

      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

      This does not seem to occur when the batch size is larger or less threads are used.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andre.spiegel@mongodb.com Andre Spiegel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: