[SERVER-47654] ReadThroughCache with cacheSize = 0 has weak guarantees in the presence of single consumer Created: 20/Apr/20 Updated: 29/Oct/23 Resolved: 21/Apr/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.0-rc2, 4.7.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kaloian Manassiev | Assignee: | Kaloian Manassiev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | PM-1645-Milestone-2 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Backport Requested: |
v4.4
|
||||||||
| Sprint: | Sharding 2020-05-04 | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 0 | ||||||||
| Description |
|
ReadThroughCache of size 0 provides the guarantee that as long as a ValueHandle returned by ReadThroughCache::acquireAsync is kept in scope, subsequent calls to acquireAsync will keep returning it and won't result in a lookup. However, as soon as that ValueHandle leaves scope, the subsequent invocation of acquireAsync should look it up again. This guarantee is broken a bit, which is demonstrated by a single-threaded unit-test. Even though the ValueHandle from the current iteration goes out of scope and is destroyed at the end of this loop, since this value comes from the setting of a SharedSemiFuture, it is possible that there is still leftover reference on the ValueHandle somewhere throughout the SharedSemiFuture infrastructure, which would keep it alive. This is not necessarily terrible from the point of view of the contract of ReadThroughCache of size zero, but makes it difficult to write tests, so we should fix it. |
| Comments |
| Comment by Githook User [ 21/Apr/20 ] |
|
Author: {'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}Message: (cherry picked from commit 79cfaa04168ce3994b5499f45fd728ebccbef0bb) |
| Comment by Githook User [ 21/Apr/20 ] |
|
Author: {'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}Message: |