periodic tasks are not independent

Bug #2011587 reported by Maurice Escher
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.service
New
Undecided
Unassigned

Bug Description

Hi,

coming from manila, where the manager inherits from PeriodicTasks https://opendev.org/openstack/manila/src/branch/stable/2023.1/manila/manager.py#L68

the tasks https://opendev.org/openstack/manila/src/branch/stable/2023.1/manila/manager.py#L99-L101 are started by a timer https://opendev.org/openstack/manila/src/branch/stable/2023.1/manila/service.py#L182-L183 with https://opendev.org/openstack/manila/src/branch/stable/2023.1/manila/service.py#L273-L276

For the sake of making an understandable example let's simplify a bit:
I have
- task A and task B decorated by @periodic_task.periodic_task(spacing=10, run_immediately=True) and
- task C decorated by @periodic_task.periodic_task in my manager

My timer interval is 20 seconds, no initial delay.
Task B takes 35 seconds to complete.

Expected behaviour:
- Task A runs every 10 seconds.
- Unsure what to expect for Task B:
-- a) runs every 35 seconds
-- b) runs every 10 seconds, with multiple tasks of the same kind running in parallel
-- c) runs every 40 seconds (when the next timer tick comes around after completion)
- After 60 seconds initial delay task C runs every 60 seconds.

Observed behaviour:
Warning log line 'Function 'manila.service.Service.periodic_tasks' run outlasted interval by 15 sec' not telling me which task is the offender.

- Task A runs every 35 seconds.
- Task B runs every 35 seconds.
- Task C runs after initial delay sometimes after 35 seconds, sometimes after 60+15 seconds

Is is expected that my slow task B is affecting the interval at which my tasks A and C running?

When researching I stumbled upon https://review.opendev.org/c/openstack/neutron/+/147710, I think I'm not alone :)

Should I make different configuration/code in order to get my expected independent periodic tasks or is this behaviour a bug or rather a known limitation?

Thanks,
Maurice

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.