diff --git a/temporal/server_impl.go b/temporal/server_impl.go index 5568f3a08ec1..f91efb801b41 100644 --- a/temporal/server_impl.go +++ b/temporal/server_impl.go @@ -40,6 +40,7 @@ import ( persistenceClient "go.temporal.io/server/common/persistence/client" "go.temporal.io/server/common/resolver" "go.temporal.io/server/common/resource" + "go.temporal.io/server/common/util" ) type ( @@ -146,7 +147,10 @@ func (s *ServerImpl) Stop() error { } func (s *ServerImpl) startServices() error { - ctx, cancel := context.WithTimeout(context.Background(), serviceStartTimeout) + // The membership join time may exceed the configured max join duration. + // Double the service start timeout to make sure there is enough time for start logic. + timeout := util.Max(serviceStartTimeout, 2*s.so.config.Global.Membership.MaxJoinDuration) + ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() results := make(chan startServiceResult, len(s.servicesMetadata)) for _, svcMeta := range s.servicesMetadata {