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

Bug: race condition in tests #233

Closed
roseduan opened this issue Jul 27, 2023 · 1 comment
Closed

Bug: race condition in tests #233

roseduan opened this issue Jul 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@roseduan
Copy link
Collaborator

reproduce the problem:

go test -race -test.run TestDB_Merge_6_Appending  -v ./

then an error occurred:

WARNING: DATA RACE
Read at 0x00c001146be8 by goroutine 6:
  github.com/rosedblabs/go-immutable-radix/v2.(*Node[...]).getEdge()
      /Users/roseduan/go/pkg/mod/github.com/rosedblabs/go-immutable-radix/v2@v2.0.1-0.20230614125820-f2a7bc058c90/node.go:72 +0x4a
  github.com/rosedblabs/go-immutable-radix/v2.(*Node[...]).GetWatch()
      /Users/roseduan/go/pkg/mod/github.com/rosedblabs/go-immutable-radix/v2@v2.0.1-0.20230614125820-f2a7bc058c90/node.go:119 +0x124
  github.com/rosedblabs/go-immutable-radix/v2.(*Node[...]).Get()
      /Users/roseduan/go/pkg/mod/github.com/rosedblabs/go-immutable-radix/v2@v2.0.1-0.20230614125820-f2a7bc058c90/node.go:139 +0xa6
  github.com/rosedblabs/go-immutable-radix/v2.(*Tree[...]).Get()
      /Users/roseduan/go/pkg/mod/github.com/rosedblabs/go-immutable-radix/v2@v2.0.1-0.20230614125820-f2a7bc058c90/iradix.go:654 +0x3b
  github.com/rosedblabs/rosedb/v2/index.(*IRadixTree).Get()
      /Users/roseduan/GoProjects/rosedb/index/iradix.go:32 +0x64
  github.com/rosedblabs/rosedb/v2.(*DB).Merge()
      /Users/roseduan/GoProjects/rosedb/merge.go:84 +0x4a1
  fmt.Sscanf()
      /usr/local/go/src/fmt/scan.go:114 +0x595
  github.com/rosedblabs/wal.Open()
      /Users/roseduan/go/pkg/mod/github.com/rosedblabs/wal@v1.2.1-0.20230720135650-d5d56517e0a3/wal.go:98 +0x48d
  github.com/rosedblabs/rosedb/v2.(*DB).openMergeDB()
      /Users/roseduan/GoProjects/rosedb/merge.go:143 +0x254
  github.com/rosedblabs/rosedb/v2.(*DB).loadIndexFromHintFile()
      /Users/roseduan/GoProjects/rosedb/merge.go:316 +0x165
  github.com/rosedblabs/rosedb/v2.Open()
      /Users/roseduan/GoProjects/rosedb/db.go:115 +0x7bb
  fmt.Fscanf()
      /usr/local/go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /usr/local/go/src/fmt/scan.go:114 +0x595
  github.com/rosedblabs/wal.Open()
      /Users/roseduan/go/pkg/mod/github.com/rosedblabs/wal@v1.2.1-0.20230720135650-d5d56517e0a3/wal.go:98 +0x48d
  github.com/rosedblabs/rosedb/v2.Open()
      /Users/roseduan/GoProjects/rosedb/db.go:94 +0x416
  github.com/rosedblabs/rosedb/v2.(*DB).openMergeDB()
      /Users/roseduan/GoProjects/rosedb/merge.go:137 +0x164
  github.com/rosedblabs/rosedb/v2.(*DB).Merge()
      /Users/roseduan/GoProjects/rosedb/merge.go:62 +0x197
  github.com/rosedblabs/rosedb/v2.TestDB_Merge_6_Appending()
      /Users/roseduan/GoProjects/rosedb/merge_test.go:183 +0x92b
  github.com/rosedblabs/rosedb/v2.(*DB).loadIndexFromHintFile()
      /Users/roseduan/GoProjects/rosedb/merge.go:316 +0x165
  github.com/rosedblabs/rosedb/v2.Open()
      /Users/roseduan/GoProjects/rosedb/db.go:115 +0x7bb
  fmt.Fscanf()
      /usr/local/go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /usr/local/go/src/fmt/scan.go:114 +0x595
  github.com/rosedblabs/wal.Open()
      /Users/roseduan/go/pkg/mod/github.com/rosedblabs/wal@v1.2.1-0.20230720135650-d5d56517e0a3/wal.go:98 +0x48d
  github.com/rosedblabs/rosedb/v2.Open()
      /Users/roseduan/GoProjects/rosedb/db.go:94 +0x416
  github.com/rosedblabs/rosedb/v2.TestDB_Merge_6_Appending()
      /Users/roseduan/GoProjects/rosedb/merge_test.go:147 +0xf9
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1629 +0x47
@roseduan roseduan added the bug Something isn't working label Jul 27, 2023
@roseduan
Copy link
Collaborator Author

Fixed in #234 by @Jeremy-Run
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant