fix regex remove duplicates - #4087
Merged
Merged
Conversation
Collaborator
Coverage Report for CI Build 6128Coverage decreased (-0.005%) to 90.715%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses regex execution blowups caused by inadequate thread deduplication in variable-length repetition bodies (as described in #4074), preventing exponential growth in the thread set and related OOM behavior.
Changes:
- Add a regression test that exercises variable-length repetition patterns over a long subject and ensures matching remains feasible.
- Fix
ThreadSet::remove_duplicatesto share a singleseenset across nestedSeqthread trees, enabling global deduplication across wrapper boundaries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| string/regex_test.mbt | Adds a regression test covering variable-length repetition cases that previously led to exponential thread growth/OOM. |
| internal/regex_engine/automata/thread_set.mbt | Updates duplicate-thread elimination to reuse a single seen set across nested thread trees, preventing exponential growth. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4074
The previous implementation re-create
seenevery iteration, which is wrong behavior.