-
Notifications
You must be signed in to change notification settings - Fork 170
Fix Finch Safe Mode #7725
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
base: main
Are you sure you want to change the base?
Fix Finch Safe Mode #7725
Conversation
| } | ||
| } | ||
|
|
||
| void GlobalFeatures::Shutdown() { |
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.
Explicitly destroys the metrics manager. This is then hooked into the application's main lifecycle by calling it from CobaltBrowserMainParts::PostMainMessageLoopRun()
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.
I think it would be good idea to surface this as a comment to make it clear for future maintainers
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.
Agreed. Maybe add a comment explaining why we need to explicitly destroy it.
| } | ||
| } | ||
|
|
||
| void GlobalFeatures::Shutdown() { |
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.
I think it would be good idea to surface this as a comment to make it clear for future maintainers
| kEmptyConfig, | ||
| }; | ||
|
|
||
| // This class manages the content of the experiment config stored on disk. |
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.
Nit: Probably worth updating this class' description since it is now doing extra work as tracking both experiment config and the state of the system (Crashes)
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.
So the class hasn't functionally changed. I discovered that it was checking the crash streak in the wrong file experiment_config, instead of metrics_local_state (see ExperimentConfigManager params). The class itself functionally remains the same 🙂
| // the experiment config type. | ||
| experiment_config_manager_ = | ||
| std::make_unique<ExperimentConfigManager>(experiment_config_.get()); | ||
| experiment_config_manager_ = std::make_unique<ExperimentConfigManager>( |
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.
super-nit: Since this is only used for initializing the activeExperimentIds consider moving it to the InitializeActiveExperimentIds function to keep all relevant steps around initializing experiments all together.
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.
I believe setExperimentState also calls this config manager. I think it's ok either way (since this is a member variable) as long as the GlobalFeatures ctor initializes it
f5023bb to
ef4d64e
Compare
|
|
||
| #include "cobalt/browser/cobalt_content_browser_client.h" | ||
|
|
||
| #include <iostream> |
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.
Remove..?
| // the experiment config type. | ||
| experiment_config_manager_ = | ||
| std::make_unique<ExperimentConfigManager>(experiment_config_.get()); | ||
| experiment_config_manager_ = std::make_unique<ExperimentConfigManager>( |
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.
I believe setExperimentState also calls this config manager. I think it's ok either way (since this is a member variable) as long as the GlobalFeatures ctor initializes it
| } | ||
| } | ||
|
|
||
| void GlobalFeatures::Shutdown() { |
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.
Agreed. Maybe add a comment explaining why we need to explicitly destroy it.
| // CommitPendingWrite not called here to avoid excessive disk writes. | ||
| // Features and featureParams won't be applied until the next Cobalt cold | ||
| // start so the delay is acceptable. | ||
| global_features->metrics_local_state()->CommitPendingWrite(); |
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.
Is there a particular reason we need to call CommitPendingWrite here?
| void ClearMetricsServiceClientRawPtrForTest() { metrics_service_client_ = nullptr; } | ||
| void ClearMetricsServiceClient() { metrics_service_client_ = nullptr; } | ||
|
|
||
| void ClearMetricsServiceClientRawPtrForTest() { |
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.
What exactly is ClearMetricsServiceClientRawPtrForTest for? Are you planning to add tests in this PR?
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.
I was using this for debugging. Thanks for pointing it out, I'll remove it
Safe mode is a crucial mechanism for Cobalt to fall back to a "safe" or "default" config if it receives a faulty config that causes a crash.
If we crash 3 times, we fall back to the safe config. If we crash 4 times, we fall back to the default, or "empty" config.
It was recently discovered that Safe mode was not functioning in Cobalt. This PR fixes it.
bug: 452149713