-
Notifications
You must be signed in to change notification settings - Fork 30
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
bugfix: cache deletion delay safe call to ExpiredDisruptionDelay #576
Conversation
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.
LGTM
Should we add a small documentation line that says when using dynamic targeting, disruption dynamic targeting expires after 2 minutes if the expiredDisruptionGCDelay is not set? (If I understood this line correctly)
controllers/cache_handler.go
Outdated
cacheCtx, cacheCancelFunc := context.WithTimeout(context.Background(), instance.Spec.Duration.Duration()+*r.ExpiredDisruptionGCDelay*2) | ||
deletionDelay := time.Minute * 2 | ||
|
||
if r.ExpiredDisruptionGCDelay != nil { |
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 ExpiredDisruptioonGCDelay
is not set and it defaults to -1
will this have the desired effect?
In our environment we need to disable the GC of any disruption, see #497 for details.
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, the value is set to an empty pointer there. it's what created the segfault
controllers/cache_handler.go
Outdated
@@ -511,7 +511,13 @@ func (r *DisruptionReconciler) manageInstanceSelectorCache(instance *chaosv1beta | |||
|
|||
// start the cache with a cancelable context and duration, and attach it to the controller as a watch source | |||
ch := make(chan error) | |||
cacheCtx, cacheCancelFunc := context.WithTimeout(context.Background(), instance.Spec.Duration.Duration()+*r.ExpiredDisruptionGCDelay*2) | |||
deletionDelay := time.Minute * 2 |
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.
This default value seems risky as a disruption can have no GC expiration delay and last longer than a couple of minutes. In this case, it would clear the cache for a still existing disruption.
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. It would then recreate another cache with the disruption duration, and so on until the disruption is deleted. This is not a suitable solution.
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.
lgtm, let's test in staging to confirm the new polling doesn't have too big a perf impact?
b62e21c
to
0b93390
Compare
What does this PR do?
Please briefly describe your changes as well as the motivation behind them:
Code Quality Checklist
Testing
unit
tests orend-to-end
tests.unit
tests orend-to-end
tests.