Constant leadership changes
Bug #1977798 reported by
Haw Loeung
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
John A Meinel |
Bug Description
Hi,
Running Juju 2.9.27, we're noticing a lot of leadership changes. We run cloud mirrors using the ubuntu-
We're seeing more and more leadership changes causing the syncing to fail.
| https:/
The bit of code in the charm that logs leadership changes is in the link below:
Related branches
lp://staging/~hloeung/ubuntu-repository-cache/allow-specifying-leader
- James Simpson: Approve
- Canonical IS Reviewers: Pending requested
-
Diff: 169 lines (+61/-29)4 files modifiedconfig.yaml (+5/-0)
lib/ubuntu_repository_cache/mirror.py (+43/-24)
lib/ubuntu_repository_cache/service.py (+9/-4)
lib/ubuntu_repository_cache/util.py (+4/-1)
tags: | added: canonical-is |
description: | updated |
Changed in juju: | |
status: | New → Confirmed |
Changed in juju: | |
assignee: | nobody → John A Meinel (jameinel) |
importance: | Undecided → High |
status: | Confirmed → In Progress |
milestone: | none → 2.9-next |
Changed in juju: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
So I investigated this by just creating a charm that has very simple properties: charm.CharmBase ):
class Ubuntu(
"""The simplest of charms that just gets Ubuntu up and running.
"""
def __init__(self, framework, *args):
super( ).__init_ _(framework, *args)
...
self.framework .observe( self.on. update_ status, self._on_ update_ status)
self.framework .observe( self.on. leader_ settings_ changed, self._on_ settings_ changed)
self.framework .observe( self.on. leader_ elected, self._on_elected) status( self, event):
self.model. unit.status = model.ActiveStatus( .format( load1min, load5min, load15min)) run('leader- get', capture_ output= True)
logging. info('update- status for %s, is-leader: %s:\nout: %r\nerr: %r',
self. unit.name, self.unit. is_leader( ), sub.stdout, sub.stderr)
...
...
def _on_update_
load1min, load5min, load15min = os.getloadavg()
'load: {:.2f} {:.2f} {:.2f}'
sub = subprocess.
... changed( self, event): run('leader- get', capture_ output= True)
logging. info('leader- settings- changed for %s:\nout: %r\nerr: %r', self.unit.name, sub.stdout, sub.stderr)
def _on_settings_
sub = subprocess.
def _on_elected(self, event): run('leader- get', capture_ output= True)
logging. info('leader- elected for %s:\nout: %r\nerr: %r', self.unit.name, sub.stdout, sub.stderr)
sub = subprocess.
I did see a leader- settings- change after upgrade-charm completed (which doesn't seem correct, but isn't strictly wrong nor should be happening often).
I also tested whether running `juju run --unit X -- leader-set leader_ id=SAME_ VALUE`
and I wasn't able to trigger a second leader- settings- changed event (so setting a field to the same value as it already has *shouldn't* trigger a leader- settings- changed event.)
I did also do the same thing as the linked charm where in update-status and in leader-elected it sets leader_id. In that case, I still don't see lots of calls to leader- settings- changed. (this is with a local test controller running a pre-2.9.30 Juju).
I'll try running it with 2.9.27 but I don't think we changed anything in this area.