-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 5.0 Required
-
Component/s: Aggregation Framework
-
Query Execution
-
Fully Compatible
-
ALL
-
QE 2024-09-30
-
200
BF-34995 uncovered an issue with potential underflows in memory trackers for window functions:
Tripwire assertion error: {'code': 5414200, 'codeName': 'Location5414200', 'errmsg': '_memUsageBytes not set for function'} location: {fileName:"src/mongo/db/pipeline/window_function/window_function.h", line:54, functionName:"operator()"}
There have been previous 2 bugfixes to address these issues in other versions:
- SERVER-69821: already fixed in v7.0 and above
- SERVER-61281: already fixed in v6.0 and above
Both fixes are not small and not easy/unrisky to backport to v5.0. The backport for SERVER-61281 to v5.0 was even previously declined.
The proposed solution to address the issue in the BF in v5.0 is to make a very small and targeted fix that works around the problem and is otherwise mostly side-effects free.
The suggestion is to simply turn off the original tripwire assertion in v5.0 that triggered when the tracked memory usage went down to 0, and prevent an underflow by adjusting all code locations that subtract from the memory usage tracker.
While this does not fix the potentially incorrect accounting, this would prevent the tripwire assertion from happening and will not worsen things.
This seems reasonable, given that v5.0 will EOL in October, and given that the issue should be properly fixed from v6.0 onwards by the above-mentioned PRs.