Fix compute next time in green thread of trigger

Bug #1643452 reported by zengchen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Karbor
Fix Released
High
zengchen

Bug Description

Time trigger computes next time in the green thread as following codes.

    1 def _trigger_operations(self, expect_run_time, trigger_property):

    2 now = datetime.utcnow()
    3 if expect_run_time > now and (
    4 int(timeutils.delta_seconds(now, expect_run_time)) > 0):
    5 return expect_run_time

             #ending operations to executor

    6 return self._compute_next_run_time(
    7 datetime.utcnow(), trigger_property['end_time'],
    8 trigger_property['format'],
    9 trigger_property['pattern'])

A bug will happen on the following step:
1. 'now' < 'expect_run_time ' and 'expect_run_time' - 'now' < 1(second) on line 3 4
2. the next run time returned on line 6 may still equal to parameter 'expect_run_time'
   if sending operations to executor quickly so that 'datetime.utcnow()' on
   line 7 less than 'expect_run_time'. If this happens, then '_trigger_operations' will
   be invoked immediately.

zengchen (chenzeng2)
Changed in karbor:
assignee: nobody → zengchen (chenzeng2)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to karbor (master)

Fix proposed to branch: master
Review: https://review.openstack.org/400083

Changed in karbor:
status: New → In Progress
Saggi Mizrahi (ficoos)
Changed in karbor:
importance: Undecided → High
milestone: none → ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to karbor (master)

Reviewed: https://review.openstack.org/400083
Committed: https://git.openstack.org/cgit/openstack/karbor/commit/?id=4418656e58c20d6c9157d982b493f2bd36498654
Submitter: Jenkins
Branch: master

commit 4418656e58c20d6c9157d982b493f2bd36498654
Author: zengchen <email address hidden>
Date: Mon Nov 21 15:55:46 2016 +0800

    Fix compute next time in green thread of trigger

    Change-Id: I0c93854fd60546e05799fb5a50d1735346c4695b
    Closes-Bug: #1643452

Changed in karbor:
status: In Progress → Fix Released
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.