Repository navigation
Crash support: Restore crash context on filter's posted callback - #16373
Conversation
filter's callback. Signed-off-by: Kevin Baichoo <[email protected]>
|
/assign @antoniovicente |
Signed-off-by: Kevin Baichoo <[email protected]>
Signed-off-by: Kevin Baichoo <[email protected]>
|
kill_request:crash_integration_test seems to be failing due to use-after-free in the gcc build, please take a look since it may be related to this change. |
| * dispatcher. | ||
| */ | ||
| virtual void restoreContextOnContinue( | ||
| std::vector<std::reference_wrapper<const ScopeTrackedObject>>& tracked_objects) PURE; |
There was a problem hiding this comment.
We may want to pass a ScopeTrackedObjectStack object as an argument and have the restore process add(const ScopeTrackedObject&) to populate the vector.
| // | ||
| // This is currently used to restore the underlying request context if the | ||
| // filter continues processing a request due to a callback that it had posted. | ||
| class OpaqueScopeTrackedObject : public ScopeTrackedObject { |
There was a problem hiding this comment.
This object seems somewhat close to the ScopeTrackedObjectStack object I mentioned in the comment about restore, with some slight differences:
- Would be good to have an "add" method that the restore method can use to add ScopeTrackedObject to the list of tracked objects
- Iterating through dumpState directly seems fine, but we could also keep a list of ScopeTrackerScopeState that we append to on add. We need to control the destruction of elements in the list so the destructor should do something like pop_back on the list until the list is empty.
There was a problem hiding this comment.
This object seems somewhat close to the ScopeTrackedObjectStack object
I think they are confusingly close; perhaps ScopeTrackerScopeState could be expanded to support multiple objects per tracker (with the addition of changes suggested by @antoniovicente)?
There was a problem hiding this comment.
Sure I'll go with the ScopeTrackedObjectStack that has an add method and iterates through the tracked objects ScopeTrackedObject rather than ScopeTrackerScopeState objects as the latter are only allocable on the stack.
There's a lot of similar sounding terms, so to sum up:
ScopeTrackedObject: general interface for an object that supports crash dumpingScopeTrackedObjectStack: aScopeTrackedObjectthat encaps multiple tracked objectsScopeTrackerScopeState: a RAII stack-only object that registers a givenScopeTrackedObjecton the dispatcher, and removes it on dtor.
| } | ||
|
|
||
| // Set ScopeTrackerScopeState if there's no existing crash context. | ||
| absl::optional<OpaqueScopeTrackedObject> encapsulated_object; |
There was a problem hiding this comment.
Why did you decide to use absl::optional here?
There was a problem hiding this comment.
The optional is to follow the ScopeTrackerScopeState object.
The ScopeTrackerScopeState does RAII, we install it only if there's no existing context. So to conditionally set it we could either do something similar what std::thread does allowing a default inited version that's doesn't have the underlying resource attached, or use optional. The latter seems simpler as the underlying object has less complexity.
This is less of an issue with the use of ScopeTrackedObjectStack described above.
OpaqueScopeTrackedObject. Signed-off-by: Kevin Baichoo <[email protected]>
…port Signed-off-by: Kevin Baichoo <[email protected]>
Signed-off-by: Kevin Baichoo <[email protected]>
KBaichoo
left a comment
There was a problem hiding this comment.
Thanks for the feedback!
| } | ||
|
|
||
| // Set ScopeTrackerScopeState if there's no existing crash context. | ||
| absl::optional<OpaqueScopeTrackedObject> encapsulated_object; |
There was a problem hiding this comment.
The optional is to follow the ScopeTrackerScopeState object.
The ScopeTrackerScopeState does RAII, we install it only if there's no existing context. So to conditionally set it we could either do something similar what std::thread does allowing a default inited version that's doesn't have the underlying resource attached, or use optional. The latter seems simpler as the underlying object has less complexity.
This is less of an issue with the use of ScopeTrackedObjectStack described above.
| // | ||
| // This is currently used to restore the underlying request context if the | ||
| // filter continues processing a request due to a callback that it had posted. | ||
| class OpaqueScopeTrackedObject : public ScopeTrackedObject { |
There was a problem hiding this comment.
Sure I'll go with the ScopeTrackedObjectStack that has an add method and iterates through the tracked objects ScopeTrackedObject rather than ScopeTrackerScopeState objects as the latter are only allocable on the stack.
There's a lot of similar sounding terms, so to sum up:
ScopeTrackedObject: general interface for an object that supports crash dumpingScopeTrackedObjectStack: aScopeTrackedObjectthat encaps multiple tracked objectsScopeTrackerScopeState: a RAII stack-only object that registers a givenScopeTrackedObjecton the dispatcher, and removes it on dtor.
Signed-off-by: Kevin Baichoo <[email protected]>
|
/retest Coverage seems to be a flake. |
|
Retrying Azure Pipelines: |
|
/retest Didn't restart the coverage test in the prior kick. |
|
Retrying Azure Pipelines: |
antoniovicente
left a comment
There was a problem hiding this comment.
Looks good. Thanks.
|
/assign-from @envoyproxy/senior-maintainers |
|
@envoyproxy/senior-maintainers assignee is @htuch |
Signed-off-by: Kevin Baichoo <[email protected]>
…port Signed-off-by: Kevin Baichoo <[email protected]>
Signed-off-by: Kevin Baichoo <[email protected]>
|
/retest |
|
Retrying Azure Pipelines: |
|
Think this is another flake... |
|
/retest |
|
Retrying Azure Pipelines: |
| New Features | ||
| ------------ | ||
|
|
||
| * crash support: restore crash context when processing requests or responses due to a filter's callback if the callback doesn't already restore the context. |
There was a problem hiding this comment.
Code looks good, but I would really like both here and in interface and other comments below to be more crisp on what a "filter's callback" is. I think this is one of these things that if you've spent a lot of time looking at the problem it's obvious, but to me, there are many callbacks that exist for filters; filters implement callback functions, they invoke callbacks, etc. I think giving an "e.g. foo" would help.
FWIW I think I have some intuition here based on our conversation the other day, but a random reader would not.
Signed-off-by: Kevin Baichoo <[email protected]>
…port Signed-off-by: Kevin Baichoo <[email protected]>
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
|
Retrying Azure Pipelines: |
|
@KBaichoo CI finally passed but needs merge for version history. |
…port Signed-off-by: Kevin Baichoo <[email protected]>
|
/retest |
|
Retrying Azure Pipelines: |
Signed-off-by: Kevin Baichoo <[email protected]>
|
@htuch merged and CI is now green again. |
|
Individual test cases in crash_integration_test take 34 seconds to run. That doesn't seem right. Can we look into where the time is going and if we have overly long timeouts? Sample log below /wait |
|
The longer runtime above is when running with coverage. These tests execute much faster under normal runs ~13s : https://dev.azure.com/cncf/4684fb3d-0389-4e0b-8251-221942316e06/_apis/build/builds/75936/logs/68 The tests don't do anything fancy compared to other integration tests apart from death. WDYT we should do? |
|
13 seconds for normal runs vs 420 seconds under coverage is surprising. It's possible that this is related to death tests and coverage. I guess we should merge this PR, let me take one final look. |
…oyproxy#16373) Implemented Crash Support when processing request or response due to a filter's callback. Signed-off-by: Kevin Baichoo <[email protected]> Signed-off-by: Sixiang Gu <[email protected]>
…oyproxy#16373) Implemented Crash Support when processing request or response due to a filter's callback. Signed-off-by: Kevin Baichoo <[email protected]>
Implemented Crash Support when processing request or response due to a filter's callback.
Signed-off-by: Kevin Baichoo [email protected]
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Commit Message:Implemented Crash Support when processing request or response due to a filter's callback.
Additional Description:
Risk Level: medium
Testing: Unit and E2E tests
Docs Changes: NA
Release Notes: Included
Fixes #16241
Some initial discussion on this PR is here: KBaichoo#36