From 8a614b49e15fd84bcb270ec4ed99b80bd571cc49 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Tue, 21 May 2019 11:37:15 -0700 Subject: [PATCH 1/2] Fix for reload race on global account Signed-off-by: Derek Collison --- server/accounts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/accounts.go b/server/accounts.go index 82aff2be..a3b928ee 100644 --- a/server/accounts.go +++ b/server/accounts.go @@ -264,7 +264,7 @@ func (a *Account) addClient(c *client) int { } } a.mu.Unlock() - if c != nil && c.srv != nil && a != c.srv.gacc && added { + if c != nil && c.srv != nil && a != c.srv.globalAccount() && added { c.srv.accConnsUpdate(a) } return n From ecfd1a2c85ab6b97ccdf102bba2ff25156ec5f33 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Tue, 21 May 2019 11:59:34 -0700 Subject: [PATCH 2/2] Max flapper less so Signed-off-by: Derek Collison --- server/auth.go | 2 -- server/norace_test.go | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/server/auth.go b/server/auth.go index 1cbca4af..f4b91ca9 100644 --- a/server/auth.go +++ b/server/auth.go @@ -599,8 +599,6 @@ func (s *Server) isLeafNodeAuthorized(c *client) bool { c.Debugf("Account JWT can not be found") return false } - // FIXME(dlc) - Add in check for account allowed to do leaf nodes? - // Bool or active count like client? if !s.isTrustedIssuer(acc.Issuer) { c.Debugf("Account JWT not signed by trusted operator") return false diff --git a/server/norace_test.go b/server/norace_test.go index a9b4abe2..23ac7987 100644 --- a/server/norace_test.go +++ b/server/norace_test.go @@ -131,7 +131,7 @@ func TestNoRaceRoutedQueueAutoUnsubscribe(t *testing.T) { // group bar and group baz. So 250 total per queue group. cons := []*nats.Conn{ncA, ncB} for _, c := range cons { - for i := 0; i < 125; i++ { + for i := 0; i < 100; i++ { qsub, err := c.QueueSubscribe("foo", "bar", barCb) if err != nil { t.Fatalf("Error on subscribe: %v", err) @@ -150,20 +150,20 @@ func TestNoRaceRoutedQueueAutoUnsubscribe(t *testing.T) { c.Subscribe("TEST.COMPLETE", func(m *nats.Msg) {}) } - // We coelasce now so for each server we will have all local (250) plus + // We coelasce now so for each server we will have all local (200) plus // two from the remote side for each queue group. We also create one more - // and will wait til each server has 254 subscriptions, that will make sure + // and will wait til each server has 204 subscriptions, that will make sure // that we have everything setup. checkFor(t, 10*time.Second, 100*time.Millisecond, func() error { subsA := srvA.NumSubscriptions() subsB := srvB.NumSubscriptions() - if subsA != 254 || subsB != 254 { + if subsA != 204 || subsB != 204 { return fmt.Errorf("Not all subs processed yet: %d and %d", subsA, subsB) } return nil }) - expected := int32(250) + expected := int32(200) // Now send messages from each server for i := int32(0); i < expected; i++ { c := cons[i%2]