winterhazel opened a new pull request, #14587:
URL: https://github.com/apache/cloudstack/pull/14587
### Description
During the execution of scheduled backups, if an asynchronous job expires
before the backup finishes (configuration `job.expire.minutes`), the job's
entry is removed from the database. However, the thread responsible for
scheduling the backups continues attempting to retrieve information about the
removed entry. Because no job is returned, accessing its status throws a
`NullPointerException` inside this thread, and all backup schedules stop
working.
The code has been fixed so that a missing/expired async job is treated as
finished, so expired jobs no longer prevent backups from being scheduled.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
### Feature/Enhancement Scale or Bug Severity
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [X] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
1. I configured `job.expire.minutes` to 1 minute, and `kboss.timeout` to 2
minutes.
2. I scheduled a backup.
3. After the backup started, I hung the process for in the agent using a
debugger, so that the async job would expire.
4. Before the changes, an error was thrown in the thread that schedules the
backups, and no backup was scheduled anymore.
```
2026-11-04 10:34:15,181 [acs-aio - 10347] WARN
[o.a.c.b.BackupManagerImpl:2552] (BackupPollTask:[ctx-9da2e362])
(logid:2186bb75) Catch throwable in backup scheduler
java.lang.NullPointerException: Cannot invoke
"org.apache.cloudstack.framework.jobs.impl.AsyncJobVO.getStatus()" because
"asyncJob" is null
at
org.apache.cloudstack.backup.BackupManagerImpl.checkStatusOfCurrentlyExecutingBackups(BackupManagerImpl.java:2438)
at
org.apache.cloudstack.backup.BackupManagerImpl.poll(BackupManagerImpl.java:2393)
at
org.apache.cloudstack.backup.BackupManagerImpl$5.runInContext(BackupManagerImpl.java:2550)
at
org.apache.cloudstack.managed.context.ManagedContextTimerTask$1.runInContext(ManagedContextTimerTask.java:30)
at
org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
at
org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
at
org.apache.cloudstack.managed.context.ManagedContextTimerTask.run(ManagedContextTimerTask.java:32)
at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
at java.base/java.util.TimerThread.run(Timer.java:516)
```
5. After the changes, the schedule that had an expired job was rescheduled,
and the scheduler thread continued to work as expected.
```
2026-11-04 10:44:12,347 [acs-aio - 13033] DEBUG
[o.a.c.b.BackupManagerImpl:2439] (BackupPollTask:[ctx-fc0462ec])
(logid:58761e37) The async job [97] of backup schedule [BackupSchedule
{"id":5,"schedule":"43","scheduleType":0,"vmId":8}] does not exist anymore.
Considering it as finished and scheduling the next backup job.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]