Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-06-28 12:32:44 +0300
committerQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-06-29 04:33:33 +0300
commit4b260bed370cc9795e64faa940809fd6a0b9c148 (patch)
treea6547b93ab87733491997b22dfa8c4c87ae1491b /client
parent13c9342533169e26f40af638e76d9d5b1782bcd8 (diff)
Add LookupTimeout configuration to DNS resolver
Gitaly's homegrown DNS resolver triggers DNS queries via UDP. Those queries run independently in dedicated goroutines. They are controlled by a timeout context. Recently, the lookup timeout is hard-coded to 15 seconds. This commit adds LookupTimeout configuration to the DNS resolver. Apart from providing a new config to clients, the new config is used to control and prevent goroutines from being leaked after the test suite is done. In the grpc-go versions before v1.56, the resolver is closed when the bound connection is closed. After v1.56, the resolver runs more independently. The connection doesn't wait for the resolver to finish anymore. After the test suite finishes, there might be some in-flight DNS queries are managed by the DNS resolver. When the connection is closed, those queries don't make sense anymore. They can stay until they finish. Unfortunately, the goroutine detector in the test suite complains about leaked goroutines. The resolver of a connection is not accessible from the outside. Hence, the test sets a low lookup timeout and sleeps for a while until the pending DNS queries go away.
Diffstat (limited to 'client')
-rw-r--r--client/dial.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/client/dial.go b/client/dial.go
index 4776109f7..2d7fc18e3 100644
--- a/client/dial.go
+++ b/client/dial.go
@@ -79,6 +79,7 @@ type DNSResolverBuilderConfig dnsresolver.BuilderConfig
func DefaultDNSResolverBuilderConfig() *DNSResolverBuilderConfig {
return &DNSResolverBuilderConfig{
RefreshRate: 5 * time.Minute,
+ LookupTimeout: 15 * time.Second,
Logger: logrus.StandardLogger(),
Backoff: backoff.NewDefaultExponential(rand.New(rand.NewSource(time.Now().UnixNano()))),
DefaultGrpcPort: "443",