[SERVER-31844] mapReduce unsafely disposes of its PlanExecutor Created: 06/Nov/17 Updated: 24/Nov/23 Resolved: 07/Nov/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | MapReduce, Querying |
| Affects Version/s: | 3.6.0-rc2 |
| Fix Version/s: | 3.6.0-rc4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Storch | Assignee: | David Storch |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Sprint: | Query 2017-11-13 | ||||
| Participants: | |||||
| Linked BF Score: | 0 | ||||
| Description |
|
The PlanExecutor created by the mapReduce command here is managed by the collection over which the mapReduce is running. This means that a lock on the collection must be held while the PlanExecutor is being disposed, so that deregistration of the executor is synchronized correctly with catalog-level events such as collection drops. The following dassert() checks that the correct locks are held in debug builds: The mapReduce code holds the proper locks for most of its execution, but these locks are temporarily released in order to perform the reduce step. It is possible for an exception to be thrown by Our continuous integration testing has caught this specifically in the case of a mapReduce running while the mongod is shutting down, since this causes State::reduceAndSpillInMemoryStateIfNeeded() to throw with an InterruptedAtShutdown error. The result is an invariant() failure in a debug build, though the system could also crash in a non-debug build due to using a Collection object that has been freed. |
| Comments |
| Comment by Githook User [ 07/Nov/17 ] | ||||||||||||||||||||||||||||||||||
|
Author: {'name': 'David Storch', 'username': 'dstorch', 'email': 'david.storch@10gen.com'}Message: | ||||||||||||||||||||||||||||||||||
| Comment by David Storch [ 06/Nov/17 ] | ||||||||||||||||||||||||||||||||||
|
I can reproduce this by applying the following patch:
Configuring the failpoint and then running pretty much any mapReduce should trigger the invariant() in a debug build. The failpoint can be enabled like so, when test commands have also been enabled:
|