[JAVA-1575] Remove unnecessary synchronization in NettyStream Created: 28/Nov/14 Updated: 31/Mar/15 Resolved: 08/Dec/14 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Connection Management |
| Affects Version/s: | None |
| Fix Version/s: | 3.0.0 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Ross Lawley | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
NettyStream has been observed getting into deadlocks when multiple items call stream.writeAsync - notably ParallelCollectionScanOperationSpecification.should visit all documents asynchronously would consistently lock. I removed the synchronization requirements round it the readAsync and writeAsync methods and but the new approach code needs reviewing. |
| Comments |
| Comment by Jeffrey Yemin [ 31/Mar/15 ] | ||||||
|
Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released. | ||||||
| Comment by Githook User [ 30/Jan/15 ] | ||||||
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: Added open/openAsync methods to Stream interface to make implementation simpler. Before this, implementations | ||||||
| Comment by Jeffrey Yemin [ 10/Dec/14 ] | ||||||
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: NettyStream does need some synchronization between threads calling readAsync and Netty threads calling methods in InboundBufferHandler class Branch: 3.0.x | ||||||
| Comment by Githook User [ 04/Dec/14 ] | ||||||
|
Author: {u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: Added open/openAsync methods to Stream interface to make implementation simpler. Before this, implementations | ||||||
| Comment by Jeffrey Yemin [ 04/Dec/14 ] | ||||||
|
I see the deadlock, and it's in our own code, not Netty. The problem is that you have one NIO thread with this stack
and another NIO thread with this stack:
If both readAsync and writeAsync are synchronized, that spells deadlock. So these methods should not be synchronized at all, and it's up to the caller, InternalStreamConnection, to ensure proper synchronization, which I believe it already does. |