[JAVA-2034] Just after creating the mongo client, the mongo driver may lose a single operation Created: 10/Nov/15 Updated: 08/Dec/15 Resolved: 13/Nov/15 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Async |
| Affects Version/s: | 3.1.0 |
| Fix Version/s: | 3.2.0 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Peter Hendriks | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
When multiple operations are executed on an async mongo client just after it has been created, a single operation may be lost, and no callback is fired or timeout occurs. This may lead to execution timeout errors in production code and may affect all async mongo users that use the client directly after initialisation. The attached example attempts to demonstrate the behavior. When the commented sleep() is uncommented, the example should always succeed. Otherwise, the example should fail most of the time with a "1 remaining operations" message. Note that sometimes, this example succeeds, please run it multiple times when the problem is not immediately present. |
| Comments |
| Comment by Githook User [ 13/Nov/15 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by Githook User [ 13/Nov/15 ] |
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by Jeffrey Yemin [ 12/Nov/15 ] |
|
Hi Peter, We can reproduce this now and are looking for the root cause. Thanks again, |
| Comment by Peter Hendriks [ 12/Nov/15 ] |
|
I've re-run the tests with your suggestions: 1. Each time the test fails, _id value 0 is the only one missing from the collection. |
| Comment by Jeffrey Yemin [ 12/Nov/15 ] |
|
Hi Peter, A couple of follow-up questions:
Thanks, |
| Comment by Peter Hendriks [ 12/Nov/15 ] |
|
Hi Jeff, thanks for the follow-up. If I run the JAVA2034 example, I get the same problem at the first iteration, and the following value is printed: 0: 1 remaining operations In the database, 499 documents are inserted out of the expected 500. On my machine, I need to add at least a sleep of 110 millis to make the example succeed. Note that we observed this problem on Linux and OSX, Java 1.8.0_60. I hope that helps! |
| Comment by Jeffrey Yemin [ 10/Nov/15 ] |
|
Hi Peter, I modified your test program a bit (see attached JAVA2034.java), making the following changes:
After 1000 iterations, I observed no failures. Please try running this modified test and report back the results. If you do see a failure, please check the collection to see if there are actually any documents missing of the expected 200, and if so, which one(s). If you do get failures, I'd also like to know if they continue to occur as you bump up the timeout value for the await to higher and higher values. Regards, |
| Comment by Peter Hendriks [ 10/Nov/15 ] |
|
Thanks mgardziejewski for the example code demonstrating the problem. |