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

Race in bucket stats #213

Closed
AskAlexSharov opened this issue Apr 1, 2020 · 1 comment · Fixed by #373
Closed

Race in bucket stats #213

AskAlexSharov opened this issue Apr 1, 2020 · 1 comment · Fixed by #373

Comments

@AskAlexSharov
Copy link

To reproduce run: go test -v -race -short .

RUN   TestTx_Check_ReadOnly
==================
WARNING: DATA RACE
Read at 0x00c00031e148 by goroutine 111:
  go.etcd.io/bbolt.(*Bucket).Cursor()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/bucket.go:84 +0xbf
  go.etcd.io/bbolt.(*Bucket).ForEach()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/bucket.go:388 +0x8c
  go.etcd.io/bbolt.(*Tx).checkBucket()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx.go:489 +0x1d7
  go.etcd.io/bbolt.(*Tx).check()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx.go:445 +0xa40

Previous write at 0x00c00031e148 by goroutine 9:
  go.etcd.io/bbolt.(*Bucket).Cursor()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/bucket.go:84 +0xdb
  go.etcd.io/bbolt.(*Bucket).ForEach()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/bucket.go:388 +0x8c
  go.etcd.io/bbolt.(*Tx).checkBucket()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx.go:489 +0x1d7
  go.etcd.io/bbolt.(*Tx).check()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx.go:445 +0xa40

Goroutine 111 (running) created at:
  go.etcd.io/bbolt.(*Tx).Check()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx.go:415 +0x74
  go.etcd.io/bbolt_test.TestTx_Check_ReadOnly.func2()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx_test.go:48 +0x4e

Goroutine 9 (finished) created at:
  go.etcd.io/bbolt.(*Tx).Check()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx.go:415 +0x74
  go.etcd.io/bbolt_test.TestTx_Check_ReadOnly.func2()
      /Users/alex.sharov/projects/go/src/github.com/etcd-io/bbolt/tx_test.go:48 +0x4e
==================
    TestTx_Check_ReadOnly: testing.go:906: race detected during execution of test
--- FAIL: TestTx_Check_ReadOnly (0.03s)
AskAlexSharov referenced this issue in ledgerwatch/bolt Apr 2, 2020
Port of etcd-io/bbolt@543c40a
Now tests don't crush with -race flag
Also found new race, reported to etcd/bolt: etcd-io#213
AskAlexSharov referenced this issue in ledgerwatch/bolt Apr 2, 2020
Port of etcd-io/bbolt@543c40a
Now tests don't crush with -race flag
Also found new race, reported to etcd/bolt: etcd-io#213
AskAlexSharov referenced this issue in ledgerwatch/bolt Apr 10, 2020
Port of etcd-io/bbolt@543c40a
Now tests don't crush with -race flag
Also found new race, reported to etcd/bolt: etcd-io#213
AskAlexSharov referenced this issue in ledgerwatch/bolt Apr 10, 2020
…1.14 checkptr (#22)

* Fix unsafe pointer conversions caught by Go 1.14 checkptr
Port of etcd-io/bbolt@543c40a
Now tests don't crush with -race flag
Also found new race, reported to etcd/bolt: etcd-io#213
@ptabor
Copy link
Contributor

ptabor commented Dec 30, 2022

I confirmed it still happens:

go test -v -race -short .
=== RUN   TestTx_Check_ReadOnly
    btesting.go:42: Opening bbolt DB at: /var/folders/8_/lr69_gcx3jz9q48fwss4gmbh00374n/T/TestTx_Check_ReadOnly3491146630/001/db
    btesting.go:81: Closing bbolt DB at: /var/folders/8_/lr69_gcx3jz9q48fwss4gmbh00374n/T/TestTx_Check_ReadOnly3491146630/001/db
==================
WARNING: DATA RACE
Read at 0x00c002472768 by goroutine 323:
  go.etcd.io/bbolt.(*Bucket).Cursor()
      /Users/ptab/gits/bbolt/bucket.go:84 +0x88
  go.etcd.io/bbolt.(*Bucket).ForEachBucket()
      /Users/ptab/gits/bbolt/bucket.go:400 +0x64
  go.etcd.io/bbolt.(*Tx).checkBucket()
      /Users/ptab/gits/bbolt/tx.go:487 +0x174
  go.etcd.io/bbolt.(*Tx).check()
      /Users/ptab/gits/bbolt/tx.go:443 +0x32c
  go.etcd.io/bbolt.(*Tx).Check.func1()
      /Users/ptab/gits/bbolt/tx.go:413 +0x40

Previous write at 0x00c002472768 by goroutine 322:
  go.etcd.io/bbolt.(*Bucket).Cursor()
      /Users/ptab/gits/bbolt/bucket.go:84 +0x9c
  go.etcd.io/bbolt.(*Bucket).ForEachBucket()
      /Users/ptab/gits/bbolt/bucket.go:400 +0x64
  go.etcd.io/bbolt.(*Tx).checkBucket()
      /Users/ptab/gits/bbolt/tx.go:487 +0x174
  go.etcd.io/bbolt.(*Tx).check()
      /Users/ptab/gits/bbolt/tx.go:443 +0x32c
  go.etcd.io/bbolt.(*Tx).Check.func1()
      /Users/ptab/gits/bbolt/tx.go:413 +0x40

Goroutine 323 (running) created at:
  go.etcd.io/bbolt.(*Tx).Check()
      /Users/ptab/gits/bbolt/tx.go:413 +0xd4
  go.etcd.io/bbolt_test.TestTx_Check_ReadOnly.func2()
      /Users/ptab/gits/bbolt/tx_test.go:48 +0x34

Goroutine 322 (running) created at:
  go.etcd.io/bbolt.(*Tx).Check()
      /Users/ptab/gits/bbolt/tx.go:413 +0xd4
  go.etcd.io/bbolt_test.TestTx_Check_ReadOnly.func2()
      /Users/ptab/gits/bbolt/tx_test.go:48 +0x34
==================
    testing.go:1319: race detected during execution of test
--- FAIL: TestTx_Check_ReadOnly (0.02s)

fuweid added a commit to fuweid/bbolt that referenced this issue Jan 2, 2023
Fixes: etcd-io#213

Signed-off-by: Wei Fu <fuweid89@gmail.com>
@ahrtr ahrtr closed this as completed in #373 Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants