Skip to content

Jobs: Endless loop when scheduling job with empty/zero interval values #3256

@Samk13

Description

@Samk13

Package version (if known): latest, v13

Describe the bug

When scheduling a job with interval type in the admin UI, the system enters an endless loop if no numeric values are entered in the interval fields OR if all interval fields are set to 0.
This occurs because a zero-valued timedelta is created, causing the scheduler to execute the job continuously without any delay between runs.

Steps to Reproduce

  1. Go to the Jobs administration page
  2. Click on "Schedule" action for any job
  3. Select "interval" as the schedule type
  4. Leave all interval fields (microseconds, milliseconds, seconds, minutes, hours, days, weeks) empty OR set all of them to 0
  5. Click "Save"
  6. The system enters an endless loop state "after few minutes on my local testings"

Expected behavior

The system should validate that at least one interval field has a positive value and prevent submission of invalid schedules. A clear error message should be displayed to the user indicating that at least one interval field must be greater than 0.

Additional context

The issue appears to stem from two problems:

Frontend: The ScheduleJobModal component doesn't validate interval values before submission ScheduleJobModal.js
The form allows empty or zero values to be submitted. if the value is too small "under a second" then maybe its safe to ignore or reject the form value.

Backend: TheIntervalScheduleSchema doesn't enforce that at least one field must be greater than 0 schema.py
When all fields are 0 or empty, Job.parsed_schedule creates a timedelta(**schedule) with all zero values, causing infinite execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions