matrixorigin / matrixorigin/matrixone

[Bug]: BuildJsonPlan data race

Open
#22,108 0 comments 0 reactions 1 assignee Claimed by @XuPeng-SH View on GitHub
kind/bug
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

### Is there an existing issue for the same bug?

- [x] I have checked the existing issues.

### Branch Name

main,2.2-dev

### Commit ID

latest

### Other Environment Information

```Markdown
- Hardware parameters:
- OS type:
- Others:
```

### Actual Behavior

WARNING: DATA RACE
Read at 0x00c04527e340 by goroutine 23822:
github.com/matrixorigin/matrixone/pkg/sql/plan/explain.BuildJsonPlan()
/home/xupeng/github/matrixone/pkg/sql/plan/explain/explain_query.go:189 +0xc1e
github.com/matrixorigin/matrixone/pkg/frontend.NewMarshalPlanHandler()
/home/xupeng/github/matrixone/pkg/frontend/mysql_cmd_executor.go:3670 +0x684
github.com/matrixorigin/matrixone/pkg/frontend.NewJsonPlanHandler()
/home/xupeng/github/matrixone/pkg/frontend/mysql_cmd_executor.go:3591 +0x11d
github.com/matrixorigin/matrixone/pkg/frontend.(*TxnComputationWrapper).RecordExecPlan()
/home/xupeng/github/matrixone/pkg/frontend/computation_wrapper.go:331 +0x357
github.com/matrixorigin/matrixone/pkg/frontend.executeStmt.func3()
/home/xupeng/github/matrixone/pkg/frontend/mysql_cmd_executor.go:2933 +0x1d2
runtime.deferreturn()
/data/xupeng/code/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.3.linux-amd64/src/runtime/panic.go:610 +0x5d
github.com/matrixorigin/matrixone/pkg/frontend.executeStmt()

Previous write at 0x00c04527e340 by goroutine 940:
sync/atomic.AddInt64()
/data/xupeng/code/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.3.linux-amd64/src/runtime/race_amd64.s:289 +0xb
sync/atomic.AddInt64()
:1 +0x15
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(*GlobalStats).updateTableStats()
/home/xupeng/github/matrixone/pkg/vm/engine/disttae/stats.go:527 +0xc7d
github.com/matrixorigin/matrixone/pkg/vm/engine/disttae.(*GlobalStats).updateWorker.func1()
/home/xupeng/github/matrixone/pkg/vm/engine/disttae/stats.go:344 +0x33e

### Expected Behavior

_No response_

### Steps to Reproduce

```Markdown
make debug and run bvt
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.