Public bug reported: The phased update implementation in ./systemimage/helpers.py does:
def phased_percentage(*, reset=False): global _pp_cache if _pp_cache is None: with open(UNIQUE_MACHINE_ID_FILE, 'rb') as fp: data = fp.read() now = str(time.time()).encode('us-ascii') r = random.Random() r.seed(data + now) _pp_cache = r.randint(0, 100) try: return _pp_cache finally: if reset: _pp_cache = None Since the current time is used as a seed, this function will return a different value each time it's called. The phased update model requires that, for each given machine and each given update, the calculated percentage persists. With this implementation, since the seed is different for each invocation and the result is not cached, phasing will happen much more quickly than intended. system-image should avoid using the time as a seed, and instead use a predictable (but well-distributed) seed of the machine ID plus an image identifier (perhaps full channel name + image ID). ** Affects: system-image (Ubuntu) Importance: Undecided Assignee: Barry Warsaw (barry) Status: New ** Changed in: system-image (Ubuntu) Assignee: (unassigned) => Barry Warsaw (barry) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to system-image in Ubuntu. https://bugs.launchpad.net/bugs/1383539 Title: phased update support does not give idempotent answer for each (machine,update) Status in “system-image” package in Ubuntu: New Bug description: The phased update implementation in ./systemimage/helpers.py does: def phased_percentage(*, reset=False): global _pp_cache if _pp_cache is None: with open(UNIQUE_MACHINE_ID_FILE, 'rb') as fp: data = fp.read() now = str(time.time()).encode('us-ascii') r = random.Random() r.seed(data + now) _pp_cache = r.randint(0, 100) try: return _pp_cache finally: if reset: _pp_cache = None Since the current time is used as a seed, this function will return a different value each time it's called. The phased update model requires that, for each given machine and each given update, the calculated percentage persists. With this implementation, since the seed is different for each invocation and the result is not cached, phasing will happen much more quickly than intended. system-image should avoid using the time as a seed, and instead use a predictable (but well-distributed) seed of the machine ID plus an image identifier (perhaps full channel name + image ID). To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/system-image/+bug/1383539/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp