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

sql: CI is reporting a sqliveness data race #69266

Closed
adityamaru opened this issue Aug 23, 2021 · 0 comments · Fixed by #69290
Closed

sql: CI is reporting a sqliveness data race #69266

adityamaru opened this issue Aug 23, 2021 · 0 comments · Fixed by #69290
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@adityamaru
Copy link
Contributor

Example build: https://teamcity.cockroachdb.com/viewLog.html?buildId=3342663&buildTypeId=Cockroach_UnitTests_Testrace&tab=buildResultsDiv

WARNING: DATA RACE
Write at 0x00c0051d9390 by goroutine 1397:
  github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance.(*Instance).extendSession()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance/slinstance.go:201 +0x3e5
  github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance.(*Instance).heartbeatLoop()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance/slinstance.go:230 +0x2d6
  github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance.(*Instance).createSession()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance/slinstance.go:155 +0x5bc
  github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance.(*Instance).heartbeatLoop()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance/slinstance.go:222 +0x4e4
  github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance.(*Instance).heartbeatLoop-fm()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance/slinstance.go:206 +0x5e
  github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2()
      /go/src/github.com/cockroachdb/cockroach/pkg/util/stop/stopper.go:442 +0x161

Previous read at 0x00c0051d9390 by goroutine 1081:
  github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance.(*session).Expiration()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slinstance/slinstance.go:73 +0x4b
  github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*leasedDescriptors).maybeUpdateDeadline()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/leased_descriptors.go:199 +0x1b4
  github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).MaybeUpdateDeadline()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/collection.go:133 +0x20e
  github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execStmtInOpenState()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:260 +0x125
  github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execStmt()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:127 +0x113a
  github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execPortal()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:214 +0x1d3
  github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execCmd.func2()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1714 +0x852
  github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execCmd()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1716 +0x5c4
  github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).run()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1570 +0x565
  github.com/cockroachdb/cockroach/pkg/sql.(*InternalExecutor).initConnEx.func1()
      /go/src/github.com/cockroachdb/cockroach/pkg/sql/internal.go:204 +0x8e
@adityamaru adityamaru added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-schema-deprecated Use T-sql-foundations instead labels Aug 23, 2021
craig bot pushed a commit that referenced this issue Aug 24, 2021
69290: sqlliveness/slinstance: fix data race r=ajwerner a=ajwerner

The Session implementation did not use a mutex around its expiration. That
meant that when the expiration was updated, a data race occurred.

Fixes #69266.

Release justification: bug fixes and low-risk updates to new functionality

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
@craig craig bot closed this as completed in ee331cd Aug 24, 2021
ZhouXing19 pushed a commit to ZhouXing19/cockroach that referenced this issue Aug 24, 2021
The Session implementation did not use a mutex around its expiration. That
meant that when the expiration was updated, a data race occurred.

Fixes cockroachdb#69266.

Release justification: bug fixes and low-risk updates to new functionality

Release note: None
@exalate-issue-sync exalate-issue-sync bot added T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) and removed T-sql-schema-deprecated Use T-sql-foundations instead labels May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant