Repository navigation
Conversation
When an HA attempt ends with an unchecked exception, processWork() stored the update count and state of the VM copy that was read before the attempt. The attempt has already changed the VM, so the next attempt found a different update count, treated the VM as changed by someone else and closed the work as done without restarting the VM. Read the VM again before recording its update count and state. Fixes: apache#14840
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #14919 +/- ##
=============================================
- Coverage 20.80% 3.86% -16.95%
=============================================
Files 6053 494 -5559
Lines 548466 42888 -505578
Branches 73283 8141 -65142
=============================================
- Hits 114129 1657 -112472
+ Misses 420977 40999 -379978
+ Partials 13360 232 -13128
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes: #14840
When an HA attempt ends with an unchecked exception (for example a
CloudRuntimeExceptionfrom the start of the VM), the genericcatchinHighAvailabilityManagerImpl.processWork()stores the update count and state of the VM object that was read before the attempt. The attempt has already changed the VM, so these values are stale. On the next attemptrestart()comparesvm.getUpdated()withwork.getUpdateTime(), decides that the VM was changed by someone else and returnsnull, andprocessWork()marks the work asDone. The VM stays stopped and the remaining retries are never used.This PR reads the VM again in that
catchblock before recording its update count and state, which is whatrestart()itself already does on its handled failure paths.Types of changes
Bug Severity
How Has This Been Tested?
New unit test
HighAvailabilityManagerImplTest.processWorkRecordsCurrentVmStateWhenRestartThrows:restart()throws aCloudRuntimeExceptionand the VM read after the attempt has a new update count and state. The test checks that the work stays scheduled and carries the new values.Tests run: 23, Failures: 0, Errors: 0expected:<20> but was:<0>Not tested on a live HA failure.