create task engine and run termination handler goroutine before warm pools polling #3078
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.
Summary
In this change, the termination handler goroutine is started before polling for instance target lifecycle state begins.
The windows process expects the termination handler to be invoked before it waits on the agent executing. Currently, since the termination handler is not being invoked when polling occurs, the process will not wait at all and exit after about a minute.
With this change, the goroutine for the termination handler will be started sooner.
Implementation details
The termination handler goroutine is moved out of
startAsyncRoutines
to start before the warm pools polling. Since the handler needs the task engine created, the task engine is now created before polling, however will still be initialized at a later point.Testing
make test
on both linux and windowsLinux (warm pools check enabled):
Windows (warm pools check enabled):
New tests cover the changes: yes
Description for the changelog
Run termination handler goroutine before warm pools polling
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.