Skip to content

Fix crash in scheduler when profile no longer exists - #2524

Merged
m3nu merged 1 commit into
borgbase:masterfrom
SAY-5:fix-scheduler-missing-profile-crash
Jun 27, 2026
Merged

Fix crash in scheduler when profile no longer exists#2524
m3nu merged 1 commit into
borgbase:masterfrom
SAY-5:fix-scheduler-missing-profile-crash

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

VortaScheduler.set_timer_for_profile() looks up the profile with BackupProfileModel.get_or_none(id=profile_id), which returns None when the profile no longer exists. There is already a if profile is None: return guard, but the logger.debug(...) line above it dereferences profile.schedule_fixed_hour / profile.schedule_fixed_minute first, so a missing profile crashes before the guard runs:

AttributeError: 'NoneType' object has no attribute 'schedule_fixed_hour'

This moves the debug log below the None check so the guard takes effect.

Related Issue

#2522

Motivation and Context

A scheduled timer can fire for a profile_id whose profile was deleted, which raised an unhandled AttributeError and broke scheduling. The fix lets the existing guard return cleanly in that case.

How Has This Been Tested?

Added test_set_timer_for_missing_profile, which calls set_timer_for_profile() with an id that has no matching profile and asserts it returns without raising and adds no timer. Tested on Linux.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@m3nu
m3nu merged commit 08a4998 into borgbase:master Jun 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants