Comment 5 for bug 1333682

Revision history for this message
Ian Booth (wallyworld) wrote :

After calling Login(), the client does cache the host addresses, but only if they exist. See cacheChangedAPIInfo(). The rough flow is:
- call Login
- get addresses from result, store on client state hostPorts attribute
- at some later time, cacheChangedAPIInfo() is called, but this ignores empty or nil addresses

Login gets the addresses to return by reading the apiHostPorts value from state (see below).

The mechanism to update agent.conf is via the APIAddressUpdater worker, which uses a watcher to listen for changes in the apiHostPorts value recorded in state. If something sets this value to nil or empty, then this will be propagated to each machine agent and written out to agent.conf, erasing the current non empty value.

So, any nil or empty apiHostPort addresses used by login or the address updater come from reading that value from state.

What sets the apiHostPorts value in state is the publishAPIServers() method in the peergrouper worker. This is called when triggered by a timer or when machine info changes in state.

Wild guess: going from 1.18 to 1.19 is going from a non HA to HA set up. Perhaps the peergrouper worker is triggered to publish API server info when replica set type things are still being initialised, and it calls publish with an empty set of api servers.

I'll add a check to stop empty api servers from being published and log a warning so we can see how often it might be happening.