-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Watchdog: use abort action as a default #13208
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
| #include "envoy/config/bootstrap/v3/bootstrap.pb.h" | ||
| #include "envoy/config/metrics/v3/stats.pb.h" | ||
| #include "envoy/config/trace/v3/http_tracer.pb.h" | ||
| #include "envoy/extensions/watchdog/abort_action/v3alpha/abort_action.pb.h" | ||
| #include "envoy/network/connection.h" | ||
| #include "envoy/runtime/runtime.h" | ||
| #include "envoy/server/instance.h" | ||
|
|
@@ -171,7 +172,30 @@ WatchdogImpl::WatchdogImpl(const envoy::config::bootstrap::v3::Watchdog& watchdo | |
| multikill_timeout_ = | ||
| std::chrono::milliseconds(PROTOBUF_GET_MS_OR_DEFAULT(watchdog, multikill_timeout, 0)); | ||
| multikill_threshold_ = PROTOBUF_PERCENT_TO_DOUBLE_OR_DEFAULT(watchdog, multikill_threshold, 0.0); | ||
| actions_ = watchdog.actions(); | ||
| auto actions = watchdog.actions(); | ||
|
|
||
| // Add abort_action if it's available on the given platform and killing is | ||
| // enabled since it's more helpful than the default kill action. | ||
| #ifndef WIN32 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would think this part should be platform agnostic. And it will be up to the implementation of this events to handle cross platform differences.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, yes, but the Abort Action implementation is currently marked to be excluded from Windows since it doesn't support Windows yet. See the prior PR: #12860 (comment)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for missing the review on the initial PR, but did we consider on platforms like Windows to enable the extension but fall back to the basic watchdog full process kill/panic behavior (and log the thread id to be killed and maybe more diagnostic info)? We could use Bazel platform selection instead of ifdefs to build a small platform specific "thread kill" library and that would be localized to the abort action extension (and allow us to iterate further if we are able to support the extension fully on Windows). Meta question: Not sure if the philosophy of the project is to just disable a feature/extension rather than offer a degraded experience on a different platform
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sunjayBhatia yes, if you look at this intermediate commit I was originally just having windows print out unimplemented, and the default panic behavior would kill the process. Regarding the philosophy, I've seen some other extensions that are also just disabled for windows -- some of which might just arise from lack of resources, but ultimately across platforms there are some differences in capabilities (one example being signals). Any thoughts @envoyproxy/api-shepherds ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, the difference there is that the other currently disabled extensions have external dependencies that require a decent amount of work to get compiling on Windows, we haven't gotten around to those yet so we disabled them, ultimately we will get these working with parity to other platforms
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK sorry I didn't realize that this is the direction we are going to go. Here is what I would do:
Does that work?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM. Will close this PR while making those changes, |
||
| envoy::extensions::watchdog::abort_action::v3alpha::AbortActionConfig abort_config; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question for the reviewers: There's some tension here given that the action Thoughts? |
||
| // Wait one second for the aborted thread to abort. | ||
| abort_config.mutable_wait_duration()->set_seconds(1); | ||
|
|
||
| if (kill_timeout > 0) { | ||
| envoy::config::bootstrap::v3::Watchdog::WatchdogAction* abort_action_config = actions.Add(); | ||
| abort_action_config->set_event(envoy::config::bootstrap::v3::Watchdog::WatchdogAction::KILL); | ||
| abort_action_config->mutable_config()->mutable_typed_config()->PackFrom(abort_config); | ||
| } | ||
|
|
||
| if (multikill_timeout_.count() > 0) { | ||
| envoy::config::bootstrap::v3::Watchdog::WatchdogAction* abort_action_config = actions.Add(); | ||
| abort_action_config->set_event( | ||
| envoy::config::bootstrap::v3::Watchdog::WatchdogAction::MULTIKILL); | ||
| abort_action_config->mutable_config()->mutable_typed_config()->PackFrom(abort_config); | ||
| } | ||
| #endif | ||
|
|
||
| actions_ = actions; | ||
| } | ||
|
|
||
| InitialImpl::InitialImpl(const envoy::config::bootstrap::v3::Bootstrap& bootstrap) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is going to be built-in, it shouldn't actually be an extension. Can you move it back into the core code? (Even if it is still registered as an extension.)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify a bit more on what you mean by "move it back into the core core"? For example, would I just have this as an extension that'll register on all platforms?
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I just mean it shouldn't be in the extensions directory IMO as it's no longer an extension. It's always linked. It's not a big deal and you can do as a follow up if you like.