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

Data race in TestMixedTSODeployment #6635

Closed
lhy1024 opened this issue Jun 19, 2023 · 0 comments · Fixed by #6636
Closed

Data race in TestMixedTSODeployment #6635

lhy1024 opened this issue Jun 19, 2023 · 0 comments · Fixed by #6636

Comments

@lhy1024
Copy link
Contributor

lhy1024 commented Jun 19, 2023

Flaky Test

Which jobs are failing

testing.go:1446: race detected during execution of test
--- FAIL: TestMixedTSODeployment (19.35s)

CI link

WARNING: DATA RACE
Read at 0x00c013969438 by goroutine 925857:
  github.com/tikv/pd/pkg/election.(*Leadership).Reset()
      /home/lhy1024/pd/pkg/election/leadership.go:233 +0x8d
  github.com/tikv/pd/pkg/member.(*EmbeddedEtcdMember).ResetLeader()
      /home/lhy1024/pd/pkg/member/member.go:262 +0x3d
  github.com/tikv/pd/tests.(*TestServer).ResignLeader()
      /home/lhy1024/pd/tests/cluster.go:190 +0xee
  github.com/tikv/pd/tests/integrations/tso.TestMixedTSODeployment.func2()
      /home/lhy1024/pd/tests/integrations/tso/client_test.go:446 +0x127

Previous write at 0x00c013969438 by goroutine 922036:
  github.com/tikv/pd/pkg/election.(*Leadership).Keep()
      /home/lhy1024/pd/pkg/election/leadership.go:140 +0xc5
  github.com/tikv/pd/pkg/member.(*EmbeddedEtcdMember).KeepLeader()
      /home/lhy1024/pd/pkg/member/member.go:186 +0x972
  github.com/tikv/pd/server.(*Server).campaignLeader()
      /home/lhy1024/pd/server/server.go:1567 +0x928
  github.com/tikv/pd/server.(*Server).leaderLoop()
      /home/lhy1024/pd/server/server.go:1537 +0x16a4
  github.com/tikv/pd/server.(*Server).startServerLoop.func1()
      /home/lhy1024/pd/server/server.go:598 +0x39
WARNING: DATA RACE
Write at 0x00c0120fc100 by goroutine 925857:
  sync/atomic.CompareAndSwapInt32()
      /usr/lib/go/src/runtime/race_amd64.s:310 +0xb
  sync/atomic.CompareAndSwapInt32()
      <autogenerated>:1 +0x1e
  context.(*cancelCtx).cancel()
      /usr/lib/go/src/context/context.go:460 +0xbd
  context.WithCancel.func1()
      /usr/lib/go/src/context/context.go:240 +0x54
  github.com/tikv/pd/pkg/election.(*Leadership).Reset()
      /home/lhy1024/pd/pkg/election/leadership.go:234 +0xb2
  github.com/tikv/pd/pkg/member.(*EmbeddedEtcdMember).ResetLeader()
      /home/lhy1024/pd/pkg/member/member.go:262 +0x3d
  github.com/tikv/pd/tests.(*TestServer).ResignLeader()
      /home/lhy1024/pd/tests/cluster.go:190 +0xee
  github.com/tikv/pd/tests/integrations/tso.TestMixedTSODeployment.func2()
      /home/lhy1024/pd/tests/integrations/tso/client_test.go:446 +0x127

Previous write at 0x00c0120fc100 by goroutine 922036:
  context.newCancelCtx()
      /usr/lib/go/src/context/context.go:297 +0x55
  context.withCancel()
      /usr/lib/go/src/context/context.go:275 +0x3a
  context.WithCancel()
      /usr/lib/go/src/context/context.go:239 +0x3a
  github.com/tikv/pd/pkg/election.(*Leadership).Keep()
      /home/lhy1024/pd/pkg/election/leadership.go:140 +0x5a
  github.com/tikv/pd/pkg/member.(*EmbeddedEtcdMember).KeepLeader()
      /home/lhy1024/pd/pkg/member/member.go:186 +0x972
  github.com/tikv/pd/server.(*Server).campaignLeader()
      /home/lhy1024/pd/server/server.go:1567 +0x928
  github.com/tikv/pd/server.(*Server).leaderLoop()
      /home/lhy1024/pd/server/server.go:1537 +0x16a4
  github.com/tikv/pd/server.(*Server).startServerLoop.func1()
      /home/lhy1024/pd/server/server.go:598 +0x39

Reason for failure (if possible)

when leadership is runing Keep to write keepAliveCancelFunc, if callback Reset will read and write keepAliveCancelFunc

Anything else

@lhy1024 lhy1024 added the type/ci The issue is related to CI. label Jun 19, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 20, 2023
close #6635

Signed-off-by: lhy1024 <admin@liudos.us>
ti-chi-bot bot pushed a commit that referenced this issue Jun 20, 2023
close #6635, ref #6636

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: lhy1024 <admin@liudos.us>
@lhy1024 lhy1024 reopened this Jun 28, 2023
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jun 28, 2023
close tikv#6635

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@lhy1024 lhy1024 closed this as completed Jun 28, 2023
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jun 28, 2023
close tikv#6635

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jun 28, 2023
close tikv#6635

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this issue Jun 29, 2023
close #6635, ref #6636

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: lhy1024 <admin@liudos.us>
ti-chi-bot bot pushed a commit that referenced this issue Jun 29, 2023
close #6635, ref #6636

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: lhy1024 <admin@liudos.us>
Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this issue Jun 29, 2023
close #6635, ref #6636

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: lhy1024 <admin@liudos.us>
Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this issue Jun 29, 2023
close #6635, ref #6636

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: lhy1024 <admin@liudos.us>
Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
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