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

SetReplicationMode has DATA RACE #4325

Closed
disksing opened this issue Nov 11, 2021 · 0 comments · Fixed by #4343
Closed

SetReplicationMode has DATA RACE #4325

disksing opened this issue Nov 11, 2021 · 0 comments · Fixed by #4343
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@disksing
Copy link
Contributor

disksing commented Nov 11, 2021

Bug Report

We must first clone the atomic value before updating it.


[2021-11-11T09:38:37.303Z] ==================

[2021-11-11T09:38:37.303Z] WARNING: DATA RACE

[2021-11-11T09:38:37.303Z] Write at 0x00c0014a7970 by goroutine 228:

[2021-11-11T09:38:37.303Z]   reflect.Value.SetString()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/reflect/value.go:1748 +0xc4

[2021-11-11T09:38:37.303Z]   encoding/json.(*decodeState).literalStore()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:955 +0x31c4

[2021-11-11T09:38:37.303Z]   encoding/json.(*decodeState).value()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:384 +0x307

[2021-11-11T09:38:37.303Z]   encoding/json.(*decodeState).object()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:765 +0x220d

[2021-11-11T09:38:37.303Z]   encoding/json.(*decodeState).value()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:370 +0xb4

[2021-11-11T09:38:37.303Z]   encoding/json.(*decodeState).object()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:765 +0x220d

[2021-11-11T09:38:37.303Z]   encoding/json.(*decodeState).value()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:370 +0xb4

[2021-11-11T09:38:37.303Z]   encoding/json.(*decodeState).unmarshal()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:180 +0x287

[2021-11-11T09:38:37.303Z]   encoding/json.Unmarshal()

[2021-11-11T09:38:37.303Z]       /usr/local/go/src/encoding/json/decode.go:107 +0x1e5

[2021-11-11T09:38:37.303Z]   github.com/tikv/pd/pkg/apiutil.ReadJSON()

[2021-11-11T09:38:37.303Z]       /home/jenkins/agent/workspace/pd_test/go/src/github.com/pingcap/pd/pkg/apiutil/apiutil.go:65 +0x29b

[2021-11-11T09:38:37.303Z]   github.com/tikv/pd/pkg/apiutil.ReadJSONRespondError()

[2021-11-11T09:38:37.303Z]       /home/jenkins/agent/workspace/pd_test/go/src/github.com/pingcap/pd/pkg/apiutil/apiutil.go:97 +0x7c

[2021-11-11T09:38:37.303Z]   github.com/tikv/pd/server/api.(*confHandler).SetReplicationMode()

[2021-11-11T09:38:37.303Z]       /home/jenkins/agent/workspace/pd_test/go/src/github.com/pingcap/pd/server/api/config.go:500 +0x1ad

[2021-11-11T09:38:37.303Z]   github.com/tikv/pd/server/api.(*confHandler).SetReplicationMode-fm()

[2021-11-11T09:38:37.303Z]       /home/jenkins/agent/workspace/pd_test/go/src/github.com/pingcap/pd/server/api/config.go:498 +0x68

[2021-11-11T09:38:37.303Z]   net/http.HandlerFunc.ServeHTTP()

What version of PD are you using (pd-server -V)?

master

@disksing disksing added the type/bug The issue is confirmed as a bug. label Nov 11, 2021
@disksing disksing self-assigned this Nov 11, 2021
disksing added a commit to oh-my-tidb/pd that referenced this issue Nov 18, 2021
disksing added a commit that referenced this issue Nov 23, 2021
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Nov 23, 2021
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Nov 23, 2021
IcePigZDB pushed a commit to IcePigZDB/pd that referenced this issue Nov 29, 2021
ti-chi-bot added a commit that referenced this issue Nov 30, 2021
ti-chi-bot added a commit that referenced this issue Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant