Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] Prevent races counting missed heartbeats #49910

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

rosstimothy
Copy link
Contributor

Backport #49882 to branch/v15

Increments the `heartbeatsMissedByAuth` gauge directly instead of
keeping a local count and setting the gauge once. This fixes a
race caught in https://github.com/gravitational/teleport/actions/runs/11828850190/job/32959672995?pr=48949.

```
==================
WARNING: DATA RACE
Write at 0x00c003857da8 by goroutine 48258:
  github.com/gravitational/teleport/lib/auth.(*Server).runPeriodicOperations.func3.1()
      /__w/teleport/teleport/lib/auth/auth.go:1471 +0x84
  github.com/gravitational/teleport/lib/services.(*UnifiedResourceCache).getRange.func1.1()
      /__w/teleport/teleport/lib/services/unified_resource.go:239 +0x14d
  github.com/google/btree.(*node[go.shape.*uint8]).iterate()
      /go/pkg/mod/github.com/google/[email protected]/btree_generic.go:522 +0x62c
  github.com/google/btree.(*BTreeG[go.shape.*uint8]).AscendRange()
      /go/pkg/mod/github.com/google/[email protected]/btree_generic.go:752 +0x104
  github.com/google/btree.(*BTreeG[*github.com/gravitational/teleport/lib/services.item]).AscendRange-fm()
      <autogenerated>:1 +0x58
  github.com/gravitational/teleport/lib/services.(*UnifiedResourceCache).getRange.func1()
      /__w/teleport/teleport/lib/services/unified_resource.go:230 +0x7a8
  github.com/gravitational/teleport/lib/services.(*UnifiedResourceCache).read()
      /__w/teleport/teleport/lib/services/unified_resource.go:591 +0x2ad
  github.com/gravitational/teleport/lib/services.(*UnifiedResourceCache).getRange()
      /__w/teleport/teleport/lib/services/unified_resource.go:215 +0x2d9
  github.com/gravitational/teleport/lib/services.(*UnifiedResourceCache).IterateUnifiedResources()
      /__w/teleport/teleport/lib/services/unified_resource.go:288 +0xe6
  github.com/gravitational/teleport/lib/auth.(*Server).runPeriodicOperations.func3()
      /__w/teleport/teleport/lib/auth/auth.go:1464 +0x237

Previous read at 0x00c003857da8 by goroutine 48219:
  github.com/gravitational/teleport/lib/auth.(*Server).runPeriodicOperations.func3()
      /__w/teleport/teleport/lib/auth/auth.go:1489 +0x2d2

Goroutine 48258 (running) created at:
  github.com/gravitational/teleport/lib/auth.(*Server).runPeriodicOperations()
      /__w/teleport/teleport/lib/auth/auth.go:1460 +0xf9e
  github.com/gravitational/teleport/lib/auth.initCluster.gowrap1()
      /__w/teleport/teleport/lib/auth/init.go:594 +0x33

Goroutine 48219 (finished) created at:
  github.com/gravitational/teleport/lib/auth.(*Server).runPeriodicOperations()
      /__w/teleport/teleport/lib/auth/auth.go:1460 +0xf9e
  github.com/gravitational/teleport/lib/auth.initCluster.gowrap1()
      /__w/teleport/teleport/lib/auth/init.go:594 +0x33
==================
```
@rosstimothy rosstimothy added the no-changelog Indicates that a PR does not require a changelog entry label Dec 6, 2024
@rosstimothy rosstimothy enabled auto-merge December 6, 2024 19:41
@github-actions github-actions bot requested review from GavinFrazar and zmb3 December 6, 2024 19:42
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-49910.d1v2yqnl3ruxch.amplifyapp.com

@rosstimothy rosstimothy added this pull request to the merge queue Dec 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 6, 2024
@rosstimothy rosstimothy added this pull request to the merge queue Dec 6, 2024
Merged via the queue into branch/v15 with commit 1578a5e Dec 6, 2024
36 checks passed
@rosstimothy rosstimothy deleted the bot/backport-49882-branch/v15 branch December 6, 2024 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants