← Back to team overview

touch-packages team mailing list archive

[Bug 1383539] Re: phased update support does not give idempotent answer for each (machine, update)

 

** Also affects: ubuntu-system-image
   Importance: Undecided
       Status: New

** No longer affects: system-image (Ubuntu)

** Changed in: ubuntu-system-image
     Assignee: (unassigned) => Barry Warsaw (barry)

** Changed in: ubuntu-system-image
   Importance: Undecided => High

** Changed in: ubuntu-system-image
    Milestone: None => 2.5.1

** Changed in: ubuntu-system-image
       Status: New => Triaged

-- 
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 Ubuntu system image (server/client/updater):
  Triaged

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-system-image/+bug/1383539/+subscriptions


References