Skip to content

Begin process of removing singleton use by StringMatcher#32829

Merged
ggreenway merged 15 commits intoenvoyproxy:mainfrom
ggreenway:fix-singleton
Mar 14, 2024
Merged

Begin process of removing singleton use by StringMatcher#32829
ggreenway merged 15 commits intoenvoyproxy:mainfrom
ggreenway:fix-singleton

Conversation

@ggreenway
Copy link
Copy Markdown
Member

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

Signed-off-by: Greg Greenway <ggreenway@apple.com>
doesn't use singletons. Add Regex to the factory context interface.

Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
@ggreenway
Copy link
Copy Markdown
Member Author

/retest

Copy link
Copy Markdown
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 <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
@ggreenway
Copy link
Copy Markdown
Member 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 <ggreenway@apple.com>
`regexEngine()` isn't yet called in the config validation path that
tests hit

Signed-off-by: Greg Greenway <ggreenway@apple.com>
@repokitteh-read-only
Copy link
Copy Markdown

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
Copy Markdown
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?

"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
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
Member Author

/retest

@ggreenway ggreenway enabled auto-merge (squash) March 14, 2024 03:46
@ggreenway ggreenway merged commit b7818b0 into envoyproxy:main Mar 14, 2024
phlax added a commit to phlax/envoy that referenced this pull request Mar 14, 2024
…oyproxy#32829)"

This reverts commit b7818b0.

Signed-off-by: Ryan Northey <ryan@synca.io>
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 <ryan@synca.io>
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