-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Verify extension lifecycle #2679
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
Verify extension lifecycle #2679
Conversation
Adds a test to ensure all extension types can be created, started, and stopped multiple times. Fix the issues found with the test on the extensions.
Codecov Report
@@ Coverage Diff @@
## main #2679 +/- ##
==========================================
+ Coverage 91.73% 91.79% +0.05%
==========================================
Files 290 290
Lines 15614 15633 +19
==========================================
+ Hits 14324 14350 +26
+ Misses 892 886 -6
+ Partials 398 397 -1
Continue to review full report at Codecov.
|
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.
Mostly LGTM, a couple minor comments. Also, the test failed on CI.
| // The runtime settings are global to the application, so while in principle it | ||
| // is possible to have more than one instance, running multiple does not bring | ||
| // any value to the service. | ||
| // In order to avoid this issue we will allow the creation of a single | ||
| // instance once per process while keeping the private function that allow | ||
| // the creation of multiple instances for unit tests. Summary: only a single | ||
| // instance can be created via the factory. | ||
| if !atomic.CompareAndSwapInt32(&instanceState, instanceNotCreated, instanceCreated) { |
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 this comment was explaining nicely the motivation, why do you need to do it differently?
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.
The comment applies to pprof since it is the one that has runtime settings for the whole process. The comments for pprof were moved to the start method.
I can't repro this locally so far, I will try some variations but may have to resort to attempting merges without certainty about the CI issue. |
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.
As pointed in the other comment, let's try to limit the new public API.
|
@bogdandrutu are we good to merge this? |
--------- Co-authored-by: Marc Alff <[email protected]> Co-authored-by: Lalit Kumar Bhasin <[email protected]> Co-authored-by: Tom Tan <[email protected]>
Why
The lifetime of extensions shouldn't be tied to single creation and start. It should be possible to create multiple instances even if they are limited to having only one active instance. This allows changing the extensions without restarting the process.
What
Description:
Ensure that extensions can be created and started multiple times. This change adds a test to ensure all extension types can be created, started, and stopped multiple times and fixes the issues found during the test of the default extensions.
healthcheckextensionandzpagesextension) were being limited to be created only once per process. The artificial limitation was removed;pprofextensionshould only have one extension active since its settings are global to the process. The extension now controls for active instances, not the creation of instances, since it is more appropriate.Testing: