[SERVER-82167] $regex may use unbounded cpu and memory Created: 13/Oct/23  Updated: 17/Oct/23

Status: Investigating
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Matt Broadstone Assignee: Shameek Ray
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-22224 $near query uses unbounded memory Backlog
is related to SERVER-24375 Deduping in OR, SORT_MERGE, and IXSCA... Backlog
Assigned Teams:
Service Arch
Operating System: ALL
Sprint: Service Arch 2023-10-30
Participants:

 Description   

Once the server admits a regular expression operation and hands it over the PCRE engine we no longer have control over its resource utilization. This can break the cloud QoS implementation by preventing feedback from the mongod from being integrated in request throttling in the router, but also may result in a noisy neighbor problem on the mongod.

Two possible mitigations were discussed:

  • Perform regex matching on a dedicated thread with a low priority (see nice)
  • Use  pcre2_set_match_limit to "page" regex results. Each time we reach a limit would be an opportunity to yield the matching to re-engage with execution control

Generated at Thu Feb 08 06:48:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.