[JAVA-1184] Timeout while writing from multiple threads Created: 25/Apr/14  Updated: 11/Sep/19  Resolved: 05/Nov/15

Status: Closed
Project: Java Driver
Component/s: Performance
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Andre Spiegel Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.



 Comments   
Comment by Jeffrey Yemin [ 05/Nov/15 ]

I'm convinced now that you were using a really old pre-release version of the 3.0 driver. The last time that org.mongodb.MongoCollectionImpl.$MongoCollectionView, which is in the stack trace, existed in the source tree was in this git hash from mid-2014.

Given that, I'm going to close this issue.

Generated at Thu Feb 08 08:53:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.