[SERVER-50064] Make recursion depth thread-local in ServiceExecutor tests Created: 31/Jul/20 Updated: 29/Oct/23 Resolved: 04/Aug/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.7.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Amirsaman Memaripour | Assignee: | Amirsaman Memaripour |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | servicearch-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Sprint: | Service Arch 2020-08-10 | ||||
| Participants: | |||||
| Linked BF Score: | 0 | ||||
| Description |
|
The atomic variable used in ServiceExecutorFixedFixture::FlattenRecursiveScheduledTasks (see here) to track the recursion depth should be replaced by a thread-local integer, making it safe for multiple executor threads to run tasks without concurrently bumping up the recursion depth. Having a thread-local variable to track recursion depth is necessary since another executor thread (i.e., exec2) may start executing a task immediately after it's been scheduled by another thread (i.e., exec1), making it appear as the thread that scheduled the task (exec1) is executing it recursively. |
| Comments |
| Comment by Githook User [ 04/Aug/20 ] |
|
Author: {'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}Message: |
| Comment by Billy Donahue [ 03/Aug/20 ] |
Maybe we can talk about it offline. |
| Comment by Amirsaman Memaripour [ 03/Aug/20 ] |
|
billy.donahue, we check the provided flag and recurse here, so if any of the executor threads attempt to recurse, the thread-local recursionDepth variable for that executor thread will have a value greater than one. |
| Comment by Billy Donahue [ 03/Aug/20 ] |
|
How do you know the ServiceExecutor is going to use the same thread for all the steps of the recursion?
|