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

data race #422

Open
dajohi opened this issue Aug 10, 2022 · 0 comments
Open

data race #422

dajohi opened this issue Aug 10, 2022 · 0 comments

Comments

@dajohi
Copy link
Contributor

dajohi commented Aug 10, 2022

env GORACE=halt_on_error=1 go test -race ./...

==================
WARNING: DATA RACE
Read at 0x00c0001afd50 by goroutine 2253:
  runtime.chansend()
      /opt/hostedtoolcache/go/1.19.0/x64/src/runtime/chan.go:160 +0x0
  github.com/syndtr/goleveldb/leveldb.cAuto.ack()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_compaction.go:695 +0x87
  github.com/syndtr/goleveldb/leveldb.(*DB).mCompaction()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_compaction.go:787 +0xea
  github.com/syndtr/goleveldb/leveldb.openDB.func4()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:155 +0x39
Previous write at 0x00c0001afd50 by goroutine 2248:
  runtime.closechan()
      /opt/hostedtoolcache/go/1.19.0/x64/src/runtime/chan.go:357 +0x0
  github.com/syndtr/goleveldb/leveldb.(*DB).compTriggerWait.func1()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_compaction.go:725 +0x39
  runtime.deferreturn()
      /opt/hostedtoolcache/go/1.19.0/x64/src/runtime/panic.go:476 +0x32
  github.com/syndtr/goleveldb/leveldb.(*DB).rotateMem()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_write.go:39 +0x75
  github.com/syndtr/goleveldb/leveldb.(*DB).flush.func1()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_write.go:106 +0x46a
  github.com/syndtr/goleveldb/leveldb.(*DB).flush()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_write.go:118 +0x2c1
  github.com/syndtr/goleveldb/leveldb.(*DB).writeLocked()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_write.go:157 +0xa6
  github.com/syndtr/goleveldb/leveldb.(*DB).Write()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_write.go:320 +0x92a
  github.com/syndtr/goleveldb/leveldb.TestDB_TransientError()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:2389 +0xe04
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  github.com/syndtr/goleveldb/leveldb/testutil.(*Storage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/testutil/storage.go:349 +0x6d
  github.com/syndtr/goleveldb/leveldb.(*DB).checkAndCleanFiles()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_util.go:52 +0x1fe
  github.com/syndtr/goleveldb/leveldb.openDB()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:134 +0x7bd
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  github.com/syndtr/goleveldb/leveldb/testutil.(*Storage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/testutil/storage.go:349 +0x6d
  github.com/syndtr/goleveldb/leveldb.(*DB).recoverJournal()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:489 +0xb2
  github.com/syndtr/goleveldb/leveldb.openDB()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:129 +0x7a7
  github.com/syndtr/goleveldb/leveldb.Open()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:202 +0x35c
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  github.com/syndtr/goleveldb/leveldb/testutil.(*Storage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/testutil/storage.go:349 +0x6d
  github.com/syndtr/goleveldb/leveldb.(*session).recover.func1()
      /home/runner/work/goleveldb/goleveldb/leveldb/session.go:134 +0xd0
  runtime.deferreturn()
      /opt/hostedtoolcache/go/1.19.0/x64/src/runtime/panic.go:476 +0x32
  github.com/syndtr/goleveldb/leveldb.Open()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:188 +0x104
  github.com/syndtr/goleveldb/leveldb.(*dbHarness).openDB0()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:98 +0xb4
  github.com/syndtr/goleveldb/leveldb.(*dbHarness).init()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:89 +0x271
  github.com/syndtr/goleveldb/leveldb.newDbHarnessWopt()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:71 +0x167
  github.com/syndtr/goleveldb/leveldb.TestDB_TransientError()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:2360 +0x3e
  testing.tRunner()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1493 +0x47
Goroutine 2253 (running) created at:
  github.com/syndtr/goleveldb/leveldb.openDB()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:155 +0xa39
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  github.com/syndtr/goleveldb/leveldb/testutil.(*Storage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/testutil/storage.go:349 +0x6d
  github.com/syndtr/goleveldb/leveldb.(*DB).checkAndCleanFiles()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_util.go:52 +0x1fe
  github.com/syndtr/goleveldb/leveldb.openDB()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:134 +0x7bd
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  fmt.Fscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  github.com/syndtr/goleveldb/leveldb/testutil.(*Storage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/testutil/storage.go:349 +0x6d
  github.com/syndtr/goleveldb/leveldb.(*DB).recoverJournal()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:489 +0xb2
  github.com/syndtr/goleveldb/leveldb.openDB()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:129 +0x7a7
  github.com/syndtr/goleveldb/leveldb.Open()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:202 +0x35c
  fmt.Sscanf()
      /opt/hostedtoolcache/go/1.19.0/x64/src/fmt/scan.go:114 +0x164
  github.com/syndtr/goleveldb/leveldb/storage.fsParseName()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:651 +0x26
  github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/storage/file_storage.go:465 +0x3e6
  github.com/syndtr/goleveldb/leveldb/testutil.(*Storage).List()
      /home/runner/work/goleveldb/goleveldb/leveldb/testutil/storage.go:349 +0x6d
  github.com/syndtr/goleveldb/leveldb.(*session).recover.func1()
      /home/runner/work/goleveldb/goleveldb/leveldb/session.go:134 +0xd0
  runtime.deferreturn()
      /opt/hostedtoolcache/go/1.19.0/x64/src/runtime/panic.go:476 +0x32
  github.com/syndtr/goleveldb/leveldb.Open()
      /home/runner/work/goleveldb/goleveldb/leveldb/db.go:188 +0x104
  github.com/syndtr/goleveldb/leveldb.(*dbHarness).openDB0()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:98 +0xb4
  github.com/syndtr/goleveldb/leveldb.(*dbHarness).init()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:89 +0x271
  github.com/syndtr/goleveldb/leveldb.newDbHarnessWopt()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:71 +0x167
  github.com/syndtr/goleveldb/leveldb.TestDB_TransientError()
      /home/runner/work/goleveldb/goleveldb/leveldb/db_test.go:2360 +0x3e
  testing.tRunner()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1493 +0x47
Goroutine 2248 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1493 +0x75d
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1846 +0x99
  testing.tRunner()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1446 +0x216
  testing.runTests()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1844 +0x7ec
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.19.0/x64/src/testing/testing.go:1726 +0xa84
  main.main()
      _testmain.go:263 +0x2e9
==================
FAIL	github.com/syndtr/goleveldb/leveldb	188.432s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant