Skip to content

[v14] Reuse tunnel resolvers instead of creating one per connection attempt#37719

Merged
rosstimothy merged 1 commit intobranch/v14from
tross/backport-37566/v14
Feb 5, 2024
Merged

[v14] Reuse tunnel resolvers instead of creating one per connection attempt#37719
rosstimothy merged 1 commit intobranch/v14from
tross/backport-37566/v14

Conversation

@rosstimothy
Copy link
Copy Markdown
Contributor

Backport #37566 to branch/v14

changelog: Fix memory leak in tbot caused by never closing reverse tunnel address resolvers

@rosstimothy rosstimothy changed the title Reuse tunnel resolvers instead of creating one per connection attempt [v14] Reuse tunnel resolvers instead of creating one per connection attempt Feb 2, 2024
…#37566)

The `CachingResolver` is backed by a `FnCache` but does not expose
a way to close the underlying cache. This leads to memory leaks
as captured in #37025. Instead of modifying the resolver to allow
explicit cleanup to occur, the resolvers were refactored to be
created once per process instead of per connenction attempt to the
cluster. Since the cluster address is read from the config file, it
won't be changed for the duration of the process which allows us to
safely use a single resolver. The one potential downside to this
approach is the cache may return possibly stale errors during an
outage until the entry is TTLed.

Fixes #37025
@rosstimothy rosstimothy force-pushed the tross/backport-37566/v14 branch from c26001f to 63d2b33 Compare February 2, 2024 18:16
@rosstimothy rosstimothy marked this pull request as ready for review February 2, 2024 18:43
@github-actions github-actions Bot added machine-id size/sm tctl tctl - Teleport admin tool labels Feb 2, 2024
@github-actions github-actions Bot requested review from strideynet and zmb3 February 2, 2024 18:44
@rosstimothy rosstimothy enabled auto-merge February 5, 2024 14:56
@rosstimothy rosstimothy added this pull request to the merge queue Feb 5, 2024
Merged via the queue into branch/v14 with commit 99ef7df Feb 5, 2024
@rosstimothy rosstimothy deleted the tross/backport-37566/v14 branch February 5, 2024 16:14
@fheinecke fheinecke mentioned this pull request Feb 16, 2024
This was referenced Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants