From bf6a100e26d52d622e72e3854dd3c944f32eba93 Mon Sep 17 00:00:00 2001 From: Jake Taylor <jake@privategrity.com> Date: Wed, 23 Feb 2022 20:56:56 +0000 Subject: [PATCH] Hotfix/renable historical --- go.mod | 2 +- go.sum | 3 +- interfaces/params/CMIX.go | 2 +- interfaces/params/rounds.go | 4 +- network/gateway/hostPool.go | 3 +- network/gateway/sender.go | 125 ++++++++++++++++-------------------- 6 files changed, 62 insertions(+), 77 deletions(-) diff --git a/go.mod b/go.mod index 38b3edea3..b36a47399 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( gitlab.com/elixxir/crypto v0.0.7-0.20220222221347-95c7ae58da6b gitlab.com/elixxir/ekv v0.1.6 gitlab.com/elixxir/primitives v0.0.3-0.20220222212109-d412a6e46623 - gitlab.com/xx_network/comms v0.0.4-0.20220222212058-5a37737af57e + gitlab.com/xx_network/comms v0.0.4-0.20220223204319-1a310472e098 gitlab.com/xx_network/crypto v0.0.5-0.20220222212031-750f7e8a01f4 gitlab.com/xx_network/primitives v0.0.4-0.20220222211843-901fa4a2d72b golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed diff --git a/go.sum b/go.sum index bbd892f99..a71a1e695 100644 --- a/go.sum +++ b/go.sum @@ -287,8 +287,9 @@ gitlab.com/elixxir/primitives v0.0.1/go.mod h1:kNp47yPqja2lHSiS4DddTvFpB/4D9dB2Y gitlab.com/elixxir/primitives v0.0.3-0.20220222212109-d412a6e46623 h1:NzJ06KdJd3fVJee0QvGhNr3CO+Ki8Ea1PeakZsm+rZM= gitlab.com/elixxir/primitives v0.0.3-0.20220222212109-d412a6e46623/go.mod h1:MtFIyJUQn9P7djzVlBpEYkPNnnWFTjZvw89swoXY+QM= gitlab.com/xx_network/comms v0.0.0-20200805174823-841427dd5023/go.mod h1:owEcxTRl7gsoM8c3RQ5KAm5GstxrJp5tn+6JfQ4z5Hw= -gitlab.com/xx_network/comms v0.0.4-0.20220222212058-5a37737af57e h1:PrQoTQoA6be4J+Lr/AclebS5Gz0Zm/TYC5b44qWa1PU= gitlab.com/xx_network/comms v0.0.4-0.20220222212058-5a37737af57e/go.mod h1:isHnwem0v4rTcwwHP455FhVlFyPcHkHiVz+N3s/uCSI= +gitlab.com/xx_network/comms v0.0.4-0.20220223204319-1a310472e098 h1:wGXXG3m65GpzmWmumLak5dn6Sm75iAF7qlx5uz81+Pg= +gitlab.com/xx_network/comms v0.0.4-0.20220223204319-1a310472e098/go.mod h1:isHnwem0v4rTcwwHP455FhVlFyPcHkHiVz+N3s/uCSI= gitlab.com/xx_network/crypto v0.0.3/go.mod h1:DF2HYvvCw9wkBybXcXAgQMzX+MiGbFPjwt3t17VRqRE= gitlab.com/xx_network/crypto v0.0.4/go.mod h1:+lcQEy+Th4eswFgQDwT0EXKp4AXrlubxalwQFH5O0Mk= gitlab.com/xx_network/crypto v0.0.5-0.20220222212031-750f7e8a01f4 h1:95dZDMn/hpLNwsgZO9eyQgGKaSDyh6F6+WygqZIciww= diff --git a/interfaces/params/CMIX.go b/interfaces/params/CMIX.go index db2bfa655..b7351ce00 100644 --- a/interfaces/params/CMIX.go +++ b/interfaces/params/CMIX.go @@ -39,7 +39,7 @@ func GetDefaultCMIX() CMIX { Timeout: 25 * time.Second, RetryDelay: 1 * time.Second, SendTimeout: 3 * time.Second, - DebugTag: "External", + DebugTag: "External", } } diff --git a/interfaces/params/rounds.go b/interfaces/params/rounds.go index 75e427098..4cfdbb233 100644 --- a/interfaces/params/rounds.go +++ b/interfaces/params/rounds.go @@ -60,7 +60,7 @@ func GetDefaultRounds() Rounds { MaxHistoricalRoundsRetries: 3, UncheckRoundPeriod: 20 * time.Second, ForceMessagePickupRetry: false, - SendTimeout: 1 * time.Second, - RealtimeOnly: false, + SendTimeout: 3 * time.Second, + RealtimeOnly: false, } } diff --git a/network/gateway/hostPool.go b/network/gateway/hostPool.go index 0cb7fa6c0..eed695bb9 100644 --- a/network/gateway/hostPool.go +++ b/network/gateway/hostPool.go @@ -91,11 +91,12 @@ func DefaultPoolParams() PoolParams { HostParams: connect.GetDefaultHostParams(), } p.HostParams.MaxRetries = 1 + p.HostParams.MaxSendRetries = 1 p.HostParams.AuthEnabled = false p.HostParams.EnableCoolOff = false p.HostParams.NumSendsBeforeCoolOff = 1 p.HostParams.CoolOffTimeout = 5 * time.Minute - p.HostParams.SendTimeout = 2000 * time.Millisecond + p.HostParams.SendTimeout = 1 * time.Second p.HostParams.PingTimeout = 1 * time.Second return p } diff --git a/network/gateway/sender.go b/network/gateway/sender.go index 6d7573d0d..dae588f4f 100644 --- a/network/gateway/sender.go +++ b/network/gateway/sender.go @@ -51,34 +51,26 @@ func (s *Sender) SendToAny(sendFunc func(host *connect.Host) (interface{}, error return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToAny") } else if err == nil { return result, nil - } else if strings.Contains(err.Error(), RetryableError) { - // Retry of the proxy could not communicate - jww.INFO.Printf("Unable to SendToAny via %s: non-fatal error received, retrying: %s", - proxies[proxy].GetId().String(), err) - continue - } else if strings.Contains(err.Error(), "unable to connect to target host") || - strings.Contains(err.Error(), "unable to find target host") { - // Retry of the proxy could not communicate - jww.WARN.Printf("Unable to SendToAny via %s: %s,"+ - " proxy could not contact requested host", - proxies[proxy].GetId(), err) - continue - } - - // Not retryable, now we must check whether the Host should be replaced - replaced, checkReplaceErr := s.checkReplace(proxies[proxy].GetId(), err) - if replaced { - jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s with error %s", - proxies[proxy].GetId().String(), err.Error()) } else { - if checkReplaceErr != nil { - jww.WARN.Printf("Unable to SendToAny via %s: %s. Unable to replace host: %+v", - proxies[proxy].GetId().String(), err.Error(), checkReplaceErr) - } else { - jww.WARN.Printf("Unable to SendToAny via %s: %s. Did not replace host.", + // Now we must check whether the Host should be replaced + replaced, checkReplaceErr := s.checkReplace(proxies[proxy].GetId(), err) + if replaced { + jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s with error %s", proxies[proxy].GetId().String(), err.Error()) + } else { + if checkReplaceErr != nil { + jww.WARN.Printf("Unable to SendToAny via %s: %s. Unable to replace host: %+v", + proxies[proxy].GetId().String(), err.Error(), checkReplaceErr) + } else { + jww.WARN.Printf("Unable to SendToAny via %s: %s. Did not replace host.", + proxies[proxy].GetId().String(), err.Error()) + } + } + + // End for non-retryable errors + if !strings.Contains(err.Error(), RetryableError) { + return nil, errors.WithMessage(err, "Received error with SendToAny") } - return nil, errors.WithMessage(err, "Received error with SendToAny") } } @@ -114,34 +106,26 @@ func (s *Sender) SendToPreferred(targets []*id.ID, sendFunc sendToPreferredFunc, return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToPreferred") } else if err == nil { return result, nil - } else if strings.Contains(err.Error(), RetryableError) { - // Retry of the proxy could not communicate - jww.INFO.Printf("Unable to to SendToPreferred first pass %s via %s: non-fatal error received, retrying: %s", - targets[i], targetHosts[i].GetId(), err) - continue - } else if strings.Contains(err.Error(), "unable to connect to target host") || - strings.Contains(err.Error(), "unable to find target host") { - // Retry of the proxy could not communicate - jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s, "+ - "proxy could not contact requested host", - targets[i], targetHosts[i].GetId(), err) - continue - } - - // Not retryable, now we must check whether the Host should be replaced - replaced, checkReplaceErr := s.checkReplace(targetHosts[i].GetId(), err) - if replaced { - jww.WARN.Printf("Unable to SendToPreferred first pass via %s, replaced a proxy %s with error %s", - targets[i], targetHosts[i].GetId(), err.Error()) } else { - if checkReplaceErr != nil { - jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s. Unable to replace host: %+v", - targets[i], targetHosts[i].GetId(), err.Error(), checkReplaceErr) - } else { - jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s. Did not replace host.", + // Now we must check whether the Host should be replaced + replaced, checkReplaceErr := s.checkReplace(targetHosts[i].GetId(), err) + if replaced { + jww.WARN.Printf("Unable to SendToPreferred first pass via %s, replaced a proxy %s with error %s", targets[i], targetHosts[i].GetId(), err.Error()) + } else { + if checkReplaceErr != nil { + jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s. Unable to replace host: %+v", + targets[i], targetHosts[i].GetId(), err.Error(), checkReplaceErr) + } else { + jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s. Did not replace host.", + targets[i], targetHosts[i].GetId(), err.Error()) + } + } + + // End for non-retryable errors + if !strings.Contains(err.Error(), RetryableError) { + return nil, errors.WithMessage(err, "Received error with SendToPreferred") } - return result, err } } @@ -190,30 +174,29 @@ func (s *Sender) SendToPreferred(targets []*id.ID, sendFunc sendToPreferredFunc, jww.INFO.Printf("Unable to SendToPreferred second pass %s via %s: non-fatal error received, retrying: %s", target, proxy, err) continue - } else if strings.Contains(err.Error(), "unable to connect to target host") || - strings.Contains(err.Error(), "unable to find target host") { - // Retry of the proxy could not communicate - jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s,"+ - " proxy could not contact requested host", - target, proxy, err) - continue - } - - // Not retryable, now we must check whether the Host should be replaced - replaced, checkReplaceErr := s.checkReplace(proxy.GetId(), err) - badProxies[proxy.String()] = nil - if replaced { - jww.WARN.Printf("Unable to SendToPreferred second pass via %s, replaced a proxy %s with error %s", - target, proxy.GetId(), err.Error()) + } else if err == nil { + return result, nil } else { - if checkReplaceErr != nil { - jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s. Unable to replace host: %+v", - target, proxy.GetId(), err.Error(), checkReplaceErr) - } else { - jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s. Did not replace host.", + // Now we must check whether the Host should be replaced + replaced, checkReplaceErr := s.checkReplace(proxy.GetId(), err) + badProxies[proxy.String()] = nil + if replaced { + jww.WARN.Printf("Unable to SendToPreferred second pass via %s, replaced a proxy %s with error %s", target, proxy.GetId(), err.Error()) + } else { + if checkReplaceErr != nil { + jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s. Unable to replace host: %+v", + target, proxy.GetId(), err.Error(), checkReplaceErr) + } else { + jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s. Did not replace host.", + target, proxy.GetId(), err.Error()) + } + } + + // End for non-retryable errors + if !strings.Contains(err.Error(), RetryableError) { + return nil, errors.WithMessage(err, "Received error with SendToPreferred") } - return result, err } } } -- GitLab