Conversation
Each backup poll checks every schedule that carries an async job id before it submits the scheduled backups that are due. It dereferenced getAsyncJob(id).getStatus() without handling a missing job, but the async job GC expunges expired jobs, unfinished ones included, and does not clear the backup schedules that still reference them. The NullPointerException then ended the whole poll before scheduleBackups() ran, on every tick, so no schedule handled by that poll fired again until a management server restart reset the job ids. A schedule whose job no longer exists is now treated as finished and moved on to its next run, and each schedule is checked on its own, so one bad record can no longer stop the others. Also log the failure to clean up an Instance after a failed create Instance from backup at WARN rather than DEBUG: the Instance remains, and its volumes may hold none of the backup's data.
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
Every backup poll first checks the schedules that carry an async job id, then submits the scheduled
backups that are due:
checkStatusOfCurrentlyExecutingBackups()dereferencedasyncJobManager.getAsyncJob(id).getStatus()without handling a missing job. A job can go missing while a schedule still points at it: the async
job GC (
AsyncJobManagerImpl.getGCTask()) expunges expired jobs, unfinished ones included, and doesnot clear the
backup_schedule.async_job_idvalues that reference them. Once that happens:NullPointerExceptionleavespoll()beforescheduleBackups()runs;nothing repairs it while the management server runs. Only a restart clears it, because
start()resets every schedule's job id through
scheduleNextBackupJob().Nothing outside the log says anything is wrong: scheduled backups simply stop being taken.
This change:
WARN naming the schedule, the Instance and the missing job id;
longer stop the others from being checked or from being scheduled;
of DEBUG. That Instance remains, and its volumes may hold none of the backup's data, so it should
not be visible only at debug level.
checkStatusOfCurrentlyExecutingBackups()andscheduleNextBackupJob()becomeprotectedso the testcan exercise the loop without a database. Their behaviour is otherwise unchanged.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
n/a
How Has This Been Tested?
Unit test
BackupManagerTest.checkStatusOfCurrentlyExecutingBackupsRepairsAScheduleWhoseJobIsGone,with three schedules in one poll:
Before the change the test fails with exactly the production error:
After it,
BackupManagerTestruns 87 tests, 0 failures, with checkstyle enabled(
mvn -pl server -Dtest=BackupManagerTest test, JDK 17). Theservermodule compiles with theUserVmManagerImplchange.The failure itself was found by reading the source, not by observing it on a cluster: it needs a
schedule's job to outlive
job.expire.minuteswithout the schedule being reconciled, which a longbackup job or a poll that cannot complete for that long produces.
How did you try to break this feature and the system with this change?
(covered by the test).
async_job_idset for ever, andgetSchedulesToExecute()only selects schedules whoseasync_job_idis null, so that schedulewould never fire again.
scheduleNextBackupJob()computes the next run from the schedule itself and is already whatstart()does for every schedule, so the repair takes the same path a restart does.