Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin process of removing singleton use by StringMatcher #32829

Merged
merged 15 commits into from
Mar 14, 2024

Conversation

ggreenway
Copy link
Contributor

Commit Message: Begin process of removing singleton use by StringMatcher

This PR temporarily adds two versions of StringMatcherImpl: one that uses the existing singletons, and one that takes a factory context.

Subsequent PRs will gradually convert all uses of StringMatcherImpl to use the factory context. Then the version using singletons will be deleted, along with the code that sets the singletons.
Additional Description: This work is being broken into multiple PRs because otherwise it would be very large and difficult to review.

Part of #32792
Risk Level: low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

doesn't use singletons. Add Regex to the factory context interface.

Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
@ggreenway
Copy link
Contributor Author

/retest

Copy link
Contributor

@RyanTheOptimist RyanTheOptimist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, but I think ASAN is finding some correctness issues, eg:

source/common/common/matchers.h:104:66: runtime error: reference binding to null pointer of type 'Regex::Engine'

Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
@ggreenway
Copy link
Contributor Author

source/common/common/matchers.h:104:66: runtime error: reference binding to null pointer of type 'Regex::Engine'

Yep, some instances where I converted a nullptr to a reference. The reference was never used, but still gets flagged by asan. I think I've worked around it now, but waiting on CI.

There was also a real failure on mobile that I think I've fixed.

Signed-off-by: Greg Greenway <[email protected]>
`regexEngine()` isn't yet called in the config validation path that
tests hit

Signed-off-by: Greg Greenway <[email protected]>
Copy link

CC @envoyproxy/coverage-shephards: FYI only for changes made to (test/per_file_coverage.sh).
envoyproxy/coverage-shephards assignee is @RyanTheOptimist

🐱

Caused by: #32829 was synchronize by ggreenway.

see: more, trace.

Copy link
Contributor

@RyanTheOptimist RyanTheOptimist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo coverage. But maybe that's hard to fix?

@@ -63,7 +63,7 @@ declare -a KNOWN_LOW_COVERAGE=(
"source/extensions/listener_managers/validation_listener_manager:70.5"
"source/extensions/watchdog/profile_action:83.3"
"source/server:91.0" # flaky: be careful adjusting. See https://github.com/envoyproxy/envoy/issues/15239
"source/server/config_validation:89.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why this changed/how hard it would be to improve?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added regexEngine() to the Server::Instance. This isn't used (yet) in the config_validation path, because most of the uses of StringMatcherImpl still don't use it. Future PRs will convert all of those, and this line will get hit in coverage at that time.

@ggreenway
Copy link
Contributor Author

/retest

@ggreenway ggreenway enabled auto-merge (squash) March 14, 2024 03:46
@ggreenway ggreenway merged commit b7818b0 into envoyproxy:main Mar 14, 2024
53 of 54 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Mar 14, 2024
phlax added a commit that referenced this pull request Mar 14, 2024
#32902)

Revert "Begin process of removing singleton use by StringMatcher (#32829)"

This reverts commit b7818b0.

Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants