[JAVA-857] read failure when takes too long Created: 21/Jun/13  Updated: 24/Jan/14  Resolved: 24/Jan/14

Status: Closed
Project: Java Driver
Component/s: Connection Management
Affects Version/s: 2.10.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Wang Han Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

when i read mongodb with code below:
cursor = col.findAll();
cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
while(cursor.hasNext()) {
func(cursor.next())
}
If func takes a little longer than 20 ms, i find maybe not all tuples in the collection are visited and there is no exception thrown.The colleciton is not very big and just has about 2m small tuples. It occurs sometimes but not every time. Is it a bug in mongoDB driver.?



 Comments   
Comment by Jeffrey Yemin [ 04/Dec/13 ]

Wang,

Do you have any updates? If not, I'm going to close this ticket.

Thanks!

Comment by Jeffrey Yemin [ 12/Jul/13 ]

So you're missing documents even without a slow function in the loop? Are you using any read preference (like reading from a secondary)? Also, how do you know if you are missing documents? Since other threads are writing to the collection concurrently, how do you know how many documents should be returned? Can you provide specific numbers of how many seem to be missing, and of the missing ones, which ones are missing?

Thanks,
Jeff

Comment by Wang Han [ 25/Jun/13 ]

someone has the same problem with me and he posted in google group:
https://groups.google.com/forum/#!topic/mongodb-user/JXLx7Gu_b74

Comment by Wang Han [ 24/Jun/13 ]

There are two threads read all from the collection . And about 5 thread randomly read and write to the same collection.
If i changed this code to
when i read mongodb with code below:
cursor = col.findAll();
cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
List<T> list = new LinkedList<T>()
while(cursor.hasNext())

{ list.add(cursor.next()); }

if so, the list has all the tuples read from this collection.

It works OK in a single-machine but failed as above when using replica set.

Comment by Jeffrey Yemin [ 21/Jun/13 ]

If the cursor timed out, you would get an exception, so I'm not sure what's going on here. We will try to reproduce it.

Since you say that it does not happen every time, is there any pattern that you can discern?

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