Skip to content

Filter cb crash support - #36

Closed
KBaichoo wants to merge 10 commits into
masterfrom
filter-cb-crash-support
Closed

KBaichoo wants to merge 10 commits into
masterfrom
filter-cb-crash-support

Conversation

@KBaichoo

@KBaichoo KBaichoo commented May 5, 2021

Copy link
Copy Markdown
Owner

For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md

Commit Message: WIP Crash support for: filter that continue via callbacks but crash during that period.
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]

Bryce Anderson and others added 4 commits May 5, 2021 14:47
Add support for starttls on the client side. This is exactly the same
code as used for the server implementation, just reused.

Risk level: Low

Signed-off-by: Bryce Anderson <[email protected]>
Commit Message: Support the clear_route_cache parameter on responses
from the remote server

Risk Level: Low. Only enabled if the flag is set.

Testing: New unit test to ensure that the method is called.

Docs Changes: Marked "clear_route_cache" in the API as no longer
"not-implemented".

Release Notes: If the clear_route_cache flag is set on a
response from the external processing server, then the filter will
call the "clearRouteCache" method on the filter state. Processors
should set this flag if they have changed any headers, such as
":path", which may affect routing after the filter runs.

Signed-off-by: Gregory Brail <[email protected]>

@antoniovicente antoniovicente left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some initial feedback, didn't look at the tests in a lot of detail.

Please open up a draft PR on the public repo when you have a chance.

Comment thread include/envoy/event/dispatcher.h Resolved
Comment thread include/envoy/http/filter.h Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There's the potential question of the resumption being in the request or response direction. The example we have seen so far involves resumption in request processing, but I think it's also possible to get resumption in the response direction. Would be good to make this method name capture that in some way, possibly by including "ForEncode" / "ForDecode" in the name or possibly something about request/response. I don't know which is appropriate (if any) without looking more closely at the implementation of StreamFilterCallbacks.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

That's a good point, I will expand upon that.

I don't know of resumption in the response direction, but I could see some use cases.

@KBaichoo KBaichoo May 6, 2021 •

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

After looking at it a bit more, I think there can be one unified method. For both cases this will end up adding the L4 (between downstream and Envoy) and L7 info in the crash.

The tests handle case where we continue decode then crash, as well as continue encode, then crash.

Comment thread include/envoy/http/filter.h Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How is this different from the scope() method above? It seems very similar.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The one above just returns a ScopeTrackedObject of this while the idea behind the restoreContextOnContinue is to gather various ScopeTrackedObjects that the underlying object has access to and have those be encapsulated and registered to provide crash context.

Comment thread source/common/http/filter_manager.cc Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Having continue_context_ as a member variable doesn't feel right. I wonder if something like:

std::vector<ScopeTrackerScopeState> states;
restoreContextOnContinue(states);

could be used to construct the appropriate states. A potential issue is that the objects in states would need to be destructed in reverse order in order to preserve the stack property. I don't know if vector provides destruction order guarantees; so we may need to wrap this in a class like ScopeTrackerScopeStateStack that provides ways to add more than one scoped object and destroys them in the right order when ScopeTrackerScopeStateStack goes out of scope.

Something like:

ScopeTrackerScopeStateStack states;
restoreContextOnContinue(states);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

You're right it doesn't make sense to cache the object since it'd be a waste in the case of filter chains without continuations.

std::vector and absl::inlined_vector don't guarantee dtor order, so we'll probably have to wrap it.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

With OpaqueStateTrackedObject we avoid the issue of the vector destructor order since only one object is actually added to the stack for potentially many objects.

alyssawilk and others added 6 commits May 5, 2021 20:09
Addressing a TODO for upstream quic crypto. The clientContextConfig looks safe to access, as it does not reload, but QUIC was using the context to create a fresh Tls::ClientContextImpl per connection instead of reusing the factory built shared Ssl::ClientContextSharedPtr. This PR moves it to the ssl shared pointer.

Risk Level: low (mostly H3 only)
Testing: n/a (refactor)
Docs Changes: n/a
Release Notes: n/a
part of envoyproxy#15649

Signed-off-by: Alyssa Wilk <[email protected]>
…r threads (envoyproxy#16320)

fix an issue where CID longer than 8 bytes is replaced by a hashed 8-byte CID which isn't compatible with existing BPF filter which requires stable first 4-byte in CID.

Signed-off-by: Dan Zhang <[email protected]>
Allow the ConnectivityGrid to take an optional AlternateProtocolsCache and use that for deciding if HTTP/3 should be enabled.
Rename AlternateProtocols to AlternateProtocolsCache.
Use uint32_t instead of int for ports in AlternateProtocolsCache to match other code in Envoy.

Follow up PRs will make the AlternateProtocolsCache mandatory and will plumb it in from the ClusterManager, based on the config.

Risk Level: Low
Testing: new unit tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
Part of envoyproxy#15649
Signed-off-by: Ryan Hamilton <[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.

7 participants