While investigating BF-27079 I managed to recreate a server crash, which was detected while running mongosync suite.
The issue it that multiple multiplanners are sharing the same javascript execution context while performing the subplanning. Currently the implementation is injecting the ‘emit’ function only once to the javascript environment. This is causing issues, when that multiplanner is deallocated and another multiplanner starts executing, as emit function is not reinjected, causing heap-use-after-free issue.
Reinjecting the emit function on every evaluate call of the ExpressionInternalJsEmit will fix the issue
- is related to
-
SERVER-75159 Write unit test which re-uses operation context to execute pipeline with $_internalJsEmit expression multiple times
- Backlog