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

e2etest: data race #11773

Closed
bradfitz opened this issue Apr 17, 2024 · 1 comment · Fixed by #11786
Closed

e2etest: data race #11773

bradfitz opened this issue Apr 17, 2024 · 1 comment · Fixed by #11786
Assignees

Comments

@bradfitz
Copy link
Member

Data race in e2etests at corp 7df7fbfa5a261 (oss 26f9bbc)

ok	tailscale.io/control/entitlements
=== RUN   TestEphemeralNodeLogoutOnShutdown
==================
WARNING: DATA RACE
Write at 0x00c00[243](https://github.com/tailscale/corp/actions/runs/8723635891/job/23932303095?pr=19229#step:5:244)00b8 by goroutine 1222:
  tailscale.com/ipn/ipnlocal.(*profileManager).setPrefsLocked()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/ipn/ipnlocal/profiles.go:286 +0x38
  tailscale.com/ipn/ipnlocal.(*profileManager).SetPrefs()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/ipn/ipnlocal/profiles.go:216 +0x2f0
  tailscale.com/ipn/ipnlocal.(*LocalBackend).SetControlClientStatus()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/ipn/ipnlocal/local.go:1166 +0x11a4
  tailscale.com/control/controlclient.(*Auto).sendStatus.func1()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:607 +0x9c
  tailscale.com/util/execqueue.(*ExecQueue).run()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/util/execqueue/execqueue.go:57 +0x30
  tailscale.com/util/execqueue.(*ExecQueue).Add.gowrap2()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/util/execqueue/execqueue.go:31 +0x40

Previous read at 0x00c0024300b8 by goroutine 1072:
  tailscale.com/ipn/ipnlocal.(*profileManager).CurrentPrefs()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/ipn/ipnlocal/profiles.go:464 +0x50
  tailscale.com/ipn/ipnlocal.(*LocalBackend).onTailnetDefaultAutoUpdate()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/ipn/ipnlocal/local.go:2501 +0x2c
  tailscale.com/ipn/ipnlocal.(*LocalBackend).onTailnetDefaultAutoUpdate-fm()
      <autogenerated>:1 +0x3c
  tailscale.com/control/controlclient.(*Direct).sendMapRequest()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/direct.go:1089 +0x2fc0
  tailscale.com/control/controlclient.(*Direct).PollNetMap()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/direct.go:782 +0x388
  tailscale.com/control/controlclient.(*Auto).mapRoutine()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:508 +0x330
  tailscale.com/control/controlclient.(*Auto).Start.gowrap2()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:230 +0x34

Goroutine 1222 (running) created at:
  tailscale.com/util/execqueue.(*ExecQueue).Add()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/util/execqueue/execqueue.go:31 +0x[248](https://github.com/tailscale/corp/actions/runs/8723635891/job/23932303095?pr=19229#step:5:249)
  tailscale.com/control/controlclient.(*Auto).sendStatus()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:606 +0x2e8
  tailscale.com/control/controlclient.(*Auto).authRoutine()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:384 +0x848
  tailscale.com/control/controlclient.(*Auto).Start.gowrap1()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:229 +0x34

Goroutine 1072 (running) created at:
  tailscale.com/control/controlclient.(*Auto).Start()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:230 +0xe8
  tailscale.com/control/controlclient.New()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/control/controlclient/auto.go:156 +0x60
  tailscale.com/ipn/ipnlocal.(*LocalBackend).getNewControlClientFunc.func1()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/ipn/ipnlocal/local.go:1596 +0x4c
  tailscale.com/ipn/ipnlocal.(*LocalBackend).Start()
      tailscale.com@v1.65.0-pre.0.20240416165210-26f9bbc02be1/ipn/ipnlocal/local.go:1739 +0x1658
  tailscale.io/control/e2etest.(*testNode).logInAs()
      tailscale.io/control/e2etest/e2e_test.go:317 +0x188
  tailscale.io/control/e2etest.newTestNode()
      tailscale.io/control/e2etest/e2e_test.go:569 +0xb5c
  tailscale.io/control/e2etest.mustTestNode()
      tailscale.io/control/e2etest/e2e_test.go:491 +0x74
  tailscale.io/control/e2etest.TestEphemeralNodeLogoutOnShutdown()
      tailscale.io/control/e2etest/e2e_test.go:582 +0x1a0
  testing.tRunner()
      testing/testing.go:1689 +0x180
  testing.(*T).Run.gowrap1()
      testing/testing.go:1742 +0x40
==================
    stuntest.go:63: STUN server shutdown
    testing.go:1398: race detected during execution of test
--- FAIL: TestEphemeralNodeLogoutOnShutdown (0.37s)
FAIL	tailscale.io/control/e2etest

/cc @maisem

@bradfitz
Copy link
Member Author

cc @awly for onTailnetDefaultAutoUpdate read

@awly awly self-assigned this Apr 18, 2024
awly added a commit that referenced this issue Apr 18, 2024
Turns out, profileManager is not safe for concurrent use and I missed
all the locking infrastructure in LocalBackend, oops.

I was not able to reproduce the race even with `go test -count 100`, but
this seems like an obvious fix.

Fixes #11773
awly added a commit that referenced this issue Apr 18, 2024
Turns out, profileManager is not safe for concurrent use and I missed
all the locking infrastructure in LocalBackend, oops.

I was not able to reproduce the race even with `go test -count 100`, but
this seems like an obvious fix.

Fixes #11773
awly added a commit that referenced this issue Apr 18, 2024
Turns out, profileManager is not safe for concurrent use and I missed
all the locking infrastructure in LocalBackend, oops.

I was not able to reproduce the race even with `go test -count 100`, but
this seems like an obvious fix.

Fixes #11773

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
awly added a commit that referenced this issue Apr 18, 2024
Turns out, profileManager is not safe for concurrent use and I missed
all the locking infrastructure in LocalBackend, oops.

I was not able to reproduce the race even with `go test -count 100`, but
this seems like an obvious fix.

Fixes #11773

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants