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 the ProcessInfo #50607

Closed
Tracked by #41316
hawkingrei opened this issue Jan 21, 2024 · 2 comments · Fixed by #50696
Closed
Tracked by #41316

DATA RACE in the ProcessInfo #50607

hawkingrei opened this issue Jan 21, 2024 · 2 comments · Fixed by #50696
Labels

Comments

@hawkingrei
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

2. What did you expect to see? (Required)

3. What did you see instead (Required)

==================
WARNING: DATA RACE
Read at 0x00c0075c5368 by goroutine 17302:
  github.com/pingcap/tidb/pkg/util/expensivequery.(*Handle).Run()
      /tidb/pkg/util/expensivequery/expensivequery.go:71 +0x52e
  main.createServer.func1()
      /tidb/cmd/tidb-server/main.go:893 +0x33
Previous write at 0x00c0075c5368 by goroutine 19610:
  github.com/pingcap/tidb/pkg/session.(*session).UpdateProcessInfo()
      /tidb/pkg/session/session.go:1569 +0x1e4
  github.com/pingcap/tidb/pkg/executor.init.1.func1()
      /tidb/pkg/executor/executor.go:1484 +0x4cc
  github.com/pingcap/tidb/pkg/planner/core.(*expressionRewriter).handleScalarSubquery()
      /tidb/pkg/planner/core/expression_rewriter.go:1181 +0x1994
  github.com/pingcap/tidb/pkg/planner/core.(*expressionRewriter).Enter()
      /tidb/pkg/planner/core/expression_rewriter.go:435 +0x14fd
  github.com/pingcap/tidb/pkg/parser/ast.(*SubqueryExpr).Accept()
      /tidb/pkg/parser/ast/expressions.go:391 +0x46
  github.com/pingcap/tidb/pkg/parser/ast.(*BinaryOperationExpr).Accept()
      /tidb/pkg/parser/ast/expressions.go:217 +0x141
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).rewriteExprNode()
      /tidb/pkg/planner/core/expression_rewriter.go:205 +0x26c
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).rewriteWithPreprocess()
      /tidb/pkg/planner/core/expression_rewriter.go:146 +0x38d
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).rewrite()
      /tidb/pkg/planner/core/expression_rewriter.go:114 +0x5af
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildSelection()
      /tidb/pkg/planner/core/logical_plan_builder.go:1252 +0x515
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildSelect()
      /tidb/pkg/planner/core/logical_plan_builder.go:4321 +0x1caa
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).Build()
      /tidb/pkg/planner/core/planbuilder.go:537 +0xea4
  github.com/pingcap/tidb/pkg/planner.buildLogicalPlan()
      /tidb/pkg/planner/optimize.go:550 +0x37c
  github.com/pingcap/tidb/pkg/planner.optimize()
      /tidb/pkg/planner/optimize.go:468 +0xbc4
  github.com/pingcap/tidb/pkg/planner.Optimize()
      /tidb/pkg/planner/optimize.go:336 +0x2f7c
  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile()
      /tidb/pkg/executor/compiler.go:104 +0x83d
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      /tidb/pkg/session/session.go:2185 +0x130a
  github.com/pingcap/tidb/pkg/server.(*TiDBContext).ExecuteStmt()
      /tidb/pkg/server/driver_tidb.go:294 +0x164
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleStmt()
      /tidb/pkg/server/conn.go:2024 +0x392
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleQuery()
      /tidb/pkg/server/conn.go:1775 +0x12c6
  github.com/pingcap/tidb/pkg/server.(*clientConn).dispatch()
      /tidb/pkg/server/conn.go:1349 +0x1991
  github.com/pingcap/tidb/pkg/server.(*clientConn).Run()
      /tidb/pkg/server/conn.go:1122 +0xd90
  github.com/pingcap/tidb/pkg/server.(*Server).onConn()
      /tidb/pkg/server/server.go:713 +0x1d13
  github.com/pingcap/tidb/pkg/server.(*Server).startNetworkListener.func2()
      /tidb/pkg/server/server.go:519 +0x44
Goroutine 17302 (running) created at:
  main.createServer()
      /tidb/cmd/tidb-server/main.go:893 +0x754
  main.main()
      /tidb/cmd/tidb-server/main.go:303 +0xb96
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      /tidb/pkg/sessionctx/variable/variable.go:366 +0x289
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      /tidb/pkg/domain/sysvar_cache.go:146 +0xb10
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()
      /tidb/pkg/domain/domain.go:1724 +0xdc
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      /tidb/pkg/session/session.go:3344 +0xb24
  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()
      /tidb/pkg/domain/sysvar_cache.go:62 +0x98
  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()
      /tidb/pkg/session/session.go:3721 +0x44b
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      /tidb/pkg/session/session.go:2099 +0x1d7
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      /tidb/pkg/session/session.go:1611 +0x437
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()
      /tidb/pkg/domain/domain.go:1667 +0x150
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      /tidb/pkg/session/session.go:3337 +0xab5
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      /tidb/pkg/session/session.go:3258 +0x450
  main.createStoreAndDomain()
      /tidb/cmd/tidb-server/main.go:402 +0x3e9
  main.main()
      /tidb/cmd/tidb-server/main.go:302 +0xb79
Goroutine 19610 (running) created at:
  github.com/pingcap/tidb/pkg/server.(*Server).startNetworkListener()
      /tidb/pkg/server/server.go:519 +0xcd5
  github.com/pingcap/tidb/pkg/server.(*Server).Run.func1()
      /tidb/pkg/server/server.go:434 +0x64
================== 

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Jan 21, 2024
@crazycs520 crazycs520 removed the type/bug The issue is confirmed as a bug. label Jan 24, 2024
@crazycs520
Copy link
Contributor

This race does not affect correctness.

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 a pull request may close this issue.

4 participants