Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-94839

[v5.0] Fix underflow in window function memory tracker

    • 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:

      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.

            Assignee:
            jan.steemann@mongodb.com Jan Steemann
            Reporter:
            jan.steemann@mongodb.com Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: