Require a finalizer for timers — same as for daemons #548
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do these changes do?
Fix a bug when the timer never stops after the resource is deleted.
Description
Thorough unit-testing only covered the daemons and daemon exiting routine/ The assumption was, since timers are built-in daemons with a short handler, they will behave the same. The assumption is still valid, but the timers were defined not exactly as daemons: they didn't require a finalizer, while the daemons did.
The finalizer is supposed to slow down the deletion until the framework confirms that all the cleanups are done by removing the finalizer.
The absence of the finalizer caused an issue, where the deletion of an object was instantly fast and went unnoticed for the timer, so the timer was not stopped and continued to run.
The proper procedure is: the
metadata.deletionTimestamp
is set, the framework notices it, initiates the daemons/timers stopping, removes the finalizer, and the object actually disappears, and the "DELETED" event is sent. The actual procedure was: the object just disappeared, and the "DELETED" event was sent — but it was too late to react.Predictably, in the presence of other daemons (not timers), or the deletion handlers, the timers were stopping properly — as the finalizer was put on the object as expected.
Issues/PRs
Checklist
CONTRIBUTORS.txt