Backport of template: fix panic in change_mode=script on client restart into release/1.8.x #24061
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.
Backport
This PR is auto-generated from #24057 to be assessed for backporting due to the inclusion of the label backport/1.8.x.
The below text is copied from the body of the original PR.
When we introduced
change_mode=script
to templates, we passed the driver handle down into the template manager so we could call itsExec
method directly. But the lifecycle of the driver handle is managed by the taskrunner and isn't available when the template manager is first created. This has led to a series of patches trying to fixup the behavior (#15915, #15192, #23663, #23917). Part of the challenge in getting this right is using an interface to avoid the circular import of the driver handle.But the taskrunner already has a way to deal with this problem using a "lazy handle". The other template change modes already use this indirectly through the
Lifecycle
interface. Change the driver handleExec
call in the template manager to a newLifecycle.Exec
call that reuses the existing behavior. This eliminates the need for the template manager to know anything at all about the handle state.Fixes: #24051
Overview of commits