-
-
Notifications
You must be signed in to change notification settings - Fork 170
Open
Labels
bug 🐞Something isn't workingSomething isn't working
Description
What happened:
- During bench test, BenchmarkRPC/client_to_client_via_server-4 fails sporadically with below message.
BenchmarkRPC/client_to_client_via_server-4 fatal error: concurrent map iteration and map write
- Goroutine stack trace can be found in below link. Test runs with some changes, but not relevant to this test.
https://github.com/yorkie-team/yorkie/actions/runs/17016008924/job/48238460355
What you expected to happen:
- It's because
watchDoc
reads llrb node andbenchmarkUpdateAndSync
try to change same llrb node, those execute simultaneously.
go func() {
defer wg.Done()
watchDoc(ctx, b, c1, d1, rch1, done2)
}()
go func() {
benchmarkUpdateAndSync(b, ctx, 50, c1, d1, testKey1)
done1 <- true
}()
- If this concurrent behavior is possible in Yorkie, lock can be needed. If not, should modify testscript.
How to reproduce it (as minimally and precisely as possible):
go test -tags bench -race -bench=BenchmarkRPC/client_to_client_via_server ./test/bench
OR
go test -tags bench -bench=BenchmarkRPC/client_to_client_via_server -count=100 ./test/bench
to catch sporadic failure.
==================
WARNING: DATA RACE
Write at 0x00c000ea2bc8 by goroutine 214:
github.com/yorkie-team/yorkie/pkg/llrb.rotateLeft[go.shape.*uint8,go.shape.*uint8]()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:213 +0x3a0
github.com/yorkie-team/yorkie/pkg/llrb.(*Tree[go.shape.*uint8,go.shape.*uint8]).put()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:160 +0x288
github.com/yorkie-team/yorkie/pkg/llrb.(*Tree[go.shape.*uint8,go.shape.*uint8]).put()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:154 +0xdc
github.com/yorkie-team/yorkie/pkg/llrb.(*Tree[go.shape.*uint8,go.shape.*uint8]).put()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:154 +0xdc
github.com/yorkie-team/yorkie/pkg/llrb.(*Tree[go.shape.*uint8,go.shape.*uint8]).Put()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:76 +0x1f8
github.com/yorkie-team/yorkie/pkg/document/crdt.(*RGATreeSplit[go.shape.*uint8]).InsertAfter()
/Users/I588818/yorkieProject/yorkie/pkg/document/crdt/rga_tree_split.go:443 +0x174
github.com/yorkie-team/yorkie/pkg/document/crdt.(*RGATreeSplit[go.shape.*uint8]).edit()
/Users/I588818/yorkieProject/yorkie/pkg/document/crdt/rga_tree_split.go:518 +0x5fc
github.com/yorkie-team/yorkie/pkg/document/crdt.(*Text).Edit()
/Users/I588818/yorkieProject/yorkie/pkg/document/crdt/text.go:335 +0x23c
github.com/yorkie-team/yorkie/pkg/document/operations.(*Edit).Execute()
/Users/I588818/yorkieProject/yorkie/pkg/document/operations/edit.go:72 +0x168
github.com/yorkie-team/yorkie/pkg/document/change.(*Change).Execute()
/Users/I588818/yorkieProject/yorkie/pkg/document/change/change.go:56 +0xe0
github.com/yorkie-team/yorkie/pkg/document.(*InternalDocument).ApplyChanges()
/Users/I588818/yorkieProject/yorkie/pkg/document/internal_document.go:334 +0x19c
github.com/yorkie-team/yorkie/pkg/document.(*Document).applyChanges()
/Users/I588818/yorkieProject/yorkie/pkg/document/document.go:282 +0x118
github.com/yorkie-team/yorkie/pkg/document.(*Document).ApplyChangePack()
/Users/I588818/yorkieProject/yorkie/pkg/document/document.go:235 +0x164
github.com/yorkie-team/yorkie/client.(*Client).pushPullChanges()
/Users/I588818/yorkieProject/yorkie/client/client.go:729 +0x708
github.com/yorkie-team/yorkie/client.(*Client).Sync()
/Users/I588818/yorkieProject/yorkie/client/client.go:449 +0x10c
github.com/yorkie-team/yorkie/test/bench.benchmarkUpdateAndSync()
/Users/I588818/yorkieProject/yorkie/test/bench/grpc_bench_test.go:57 +0xd4
github.com/yorkie-team/yorkie/test/bench.BenchmarkRPC.func3.6()
/Users/I588818/yorkieProject/yorkie/test/bench/grpc_bench_test.go:199 +0x84
Previous read at 0x00c000ea2bc8 by goroutine 212:
github.com/yorkie-team/yorkie/pkg/llrb.isRed[go.shape.*uint8,go.shape.*uint8]()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:290 +0x228
github.com/yorkie-team/yorkie/pkg/llrb.(*Tree[go.shape.*uint8,go.shape.*uint8]).put()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:159 +0x1ec
github.com/yorkie-team/yorkie/pkg/llrb.(*Tree[go.shape.*uint8,go.shape.*uint8]).put()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:154 +0xdc
github.com/yorkie-team/yorkie/pkg/llrb.(*Tree[go.shape.*uint8,go.shape.*uint8]).Put()
/Users/I588818/yorkieProject/yorkie/pkg/llrb/llrb.go:76 +0x1f8
github.com/yorkie-team/yorkie/pkg/document/crdt.(*RGATreeSplit[go.shape.*uint8]).InsertAfter()
/Users/I588818/yorkieProject/yorkie/pkg/document/crdt/rga_tree_split.go:443 +0x174
github.com/yorkie-team/yorkie/pkg/document/crdt.(*RGATreeSplit[go.shape.*uint8]).edit()
/Users/I588818/yorkieProject/yorkie/pkg/document/crdt/rga_tree_split.go:518 +0x5fc
github.com/yorkie-team/yorkie/pkg/document/crdt.(*Text).Edit()
/Users/I588818/yorkieProject/yorkie/pkg/document/crdt/text.go:335 +0x23c
github.com/yorkie-team/yorkie/pkg/document/operations.(*Edit).Execute()
/Users/I588818/yorkieProject/yorkie/pkg/document/operations/edit.go:72 +0x168
github.com/yorkie-team/yorkie/pkg/document/change.(*Change).Execute()
/Users/I588818/yorkieProject/yorkie/pkg/document/change/change.go:56 +0xe0
github.com/yorkie-team/yorkie/pkg/document.(*InternalDocument).ApplyChanges()
/Users/I588818/yorkieProject/yorkie/pkg/document/internal_document.go:334 +0x19c
github.com/yorkie-team/yorkie/pkg/document.(*Document).applyChanges()
/Users/I588818/yorkieProject/yorkie/pkg/document/document.go:282 +0x118
github.com/yorkie-team/yorkie/pkg/document.(*Document).ApplyChangePack()
/Users/I588818/yorkieProject/yorkie/pkg/document/document.go:235 +0x164
github.com/yorkie-team/yorkie/client.(*Client).pushPullChanges()
/Users/I588818/yorkieProject/yorkie/client/client.go:729 +0x708
github.com/yorkie-team/yorkie/client.(*Client).Sync()
/Users/I588818/yorkieProject/yorkie/client/client.go:449 +0x10c
github.com/yorkie-team/yorkie/test/bench.watchDoc()
/Users/I588818/yorkieProject/yorkie/test/bench/grpc_bench_test.go:108 +0x220
github.com/yorkie-team/yorkie/test/bench.BenchmarkRPC.func3.4()
/Users/I588818/yorkieProject/yorkie/test/bench/grpc_bench_test.go:191 +0xc0
Goroutine 214 (running) created at:
github.com/yorkie-team/yorkie/test/bench.BenchmarkRPC.func3()
/Users/I588818/yorkieProject/yorkie/test/bench/grpc_bench_test.go:198 +0x43c
testing.(*B).runN()
/opt/homebrew/Cellar/go/1.24.3/libexec/src/testing/benchmark.go:219 +0x1f4
testing.(*B).run1.func1()
/opt/homebrew/Cellar/go/1.24.3/libexec/src/testing/benchmark.go:245 +0x70
Goroutine 212 (running) created at:
github.com/yorkie-team/yorkie/test/bench.BenchmarkRPC.func3()
/Users/I588818/yorkieProject/yorkie/test/bench/grpc_bench_test.go:189 +0x820
testing.(*B).runN()
/opt/homebrew/Cellar/go/1.24.3/libexec/src/testing/benchmark.go:219 +0x1f4
testing.(*B).run1.func1()
/opt/homebrew/Cellar/go/1.24.3/libexec/src/testing/benchmark.go:245 +0x70
==================
--- FAIL: BenchmarkRPC/client_to_client_via_server
testing.go:1490: race detected during execution of test
--- FAIL: BenchmarkRPC
Anything else we need to know?:
Environment:
- Operating system:
- Browser and version:
- Yorkie version (use
yorkie version
): v0.6.25 - Yorkie JS SDK version:
hackerwins and window9u
Metadata
Metadata
Assignees
Labels
bug 🐞Something isn't workingSomething isn't working
Type
Projects
Status
Backlog