Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.6 fix intermittent login failure #10463

Merged
merged 6 commits into from
Aug 1, 2019

Conversation

howbazaar
Copy link
Contributor

This branch fixes two different intermittent failures due to the model not being found in the model cache.
This happens when the apiserver code is creating the facade context.

The fix is to ensure that the model exists in the cache before continuing with the test. A helper method has been added to the JujuConnSuite as this is the one that triggers it most.

Additionally the apiserver is now not created in the engine until the model cache has been initialized. This will help avoid login issues to the apiserver if there are many models.

QA steps

  • bootstrap a controller
  • deploy something to ensure the components are hooked up

Documentation changes

No user facing impact.

@howbazaar
Copy link
Contributor Author

Address already in use !!build!!

@@ -29,8 +29,14 @@ type BackingWatcher interface {
Stop() error
}

// Unlocker is used to indicate that the model cache is ready to be used.
type Unlocker interface {
Unlock()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Unlock() fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

// Config describes the necessary fields for NewWorker.
type Config struct {
InitializedGate Unlocker

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will tend to stutter as variables are called gate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually none of the variables are called gate. But initialized or unlocker. The later of which is a bit odd IMO.

Copy link
Member

@jameinel jameinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the layering is fine. modelcache just takes an Unlocker which it will call when it is ready, and other things can depend on the gate.

// want to do things with those models where the actions may touch
// the model cache.
func (s *JujuConnSuite) EnsureCachedModel(c *gc.C, uuid string) {
start := time.Now()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this clearer as a

stop := time.After(testing.LongWait)
retry := time.After(0)
for {
   select {
   case <-retry:
    _, err := s.Controller.Model(uuid)
    if err == nil {
     return
   }
   timeout = time.After(testing.ShortWait)
   case <-stop:
    c.Errorf("model %v not seen in cache after %v", uuid, testing.LongWait)
    return
 }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think something with a select is better.

@howbazaar
Copy link
Contributor Author

$$merge$$

@jujubot jujubot merged commit 93ad0f9 into juju:2.6 Aug 1, 2019
@howbazaar howbazaar deleted the 2.6-fix-intermittent-login-failure branch August 1, 2019 14:53
@achilleasa achilleasa mentioned this pull request Aug 6, 2019
jujubot added a commit that referenced this pull request Aug 6, 2019
#10486

This PR syncs 2.6 and develop by forward-porting:

- #10463
- #10475
- #10481
- #10484
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants