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

TestAppEmptyAccountsGlobal prone to data race failure #3259

Closed
algonautshant opened this issue Nov 30, 2021 · 0 comments
Closed

TestAppEmptyAccountsGlobal prone to data race failure #3259

algonautshant opened this issue Nov 30, 2021 · 0 comments
Assignees

Comments

@algonautshant
Copy link
Contributor

The test calls:

// save data into DB and write into local state
commitRound(2, 0, l)

which in turns writes to l.trackers.lastFlushTime.
This write interferes with tr.lastFlushTime.Add in trackerRegistry scheduleCommit which is called during func (bq *blockQueue) syncer():

minToSave := bq.l.notifyCommit(committed)
=== RUN   TestAppEmptyAccountsGlobal
==================
WARNING: DATA RACE
Write at 0x00c004f84f68 by goroutine 73:
  github.com/algorand/go-algorand/ledger.commitRound()
      /opt/cibuild/project/ledger/applications_test.go:37 +0x4e
  github.com/algorand/go-algorand/ledger.TestAppEmptyAccountsGlobal()
      /opt/cibuild/project/ledger/applications_test.go:811 +0x1486
  testing.tRunner()
      /opt/cibuild/.gimme/versions/go1.14.7.linux.amd64/src/testing/testing.go:1039 +0x1eb

Previous read at 0x00c004f84f68 by goroutine 13:
  github.com/algorand/go-algorand/ledger.(*trackerRegistry).scheduleCommit()
      /opt/cibuild/project/ledger/tracker.go:333 +0x403
  github.com/algorand/go-algorand/ledger.(*trackerRegistry).committedUpTo()
      /opt/cibuild/project/ledger/tracker.go:302 +0x1ac
  github.com/algorand/go-algorand/ledger.(*Ledger).notifyCommit()
      /opt/cibuild/project/ledger/ledger.go:398 +0xcd
  github.com/algorand/go-algorand/ledger.(*blockQueue).syncer()
      /opt/cibuild/project/ledger/blockqueue.go:145 +0x6ea

Goroutine 73 (running) created at:
  testing.(*T).Run()
      /opt/cibuild/.gimme/versions/go1.14.7.linux.amd64/src/testing/testing.go:1090 +0x700
  testing.runTests.func1()
      /opt/cibuild/.gimme/versions/go1.14.7.linux.amd64/src/testing/testing.go:1334 +0xa6
  testing.tRunner()
      /opt/cibuild/.gimme/versions/go1.14.7.linux.amd64/src/testing/testing.go:1039 +0x1eb
  testing.runTests()
      /opt/cibuild/.gimme/versions/go1.14.7.linux.amd64/src/testing/testing.go:1332 +0x527
  testing.(*M).Run()
      /opt/cibuild/.gimme/versions/go1.14.7.linux.amd64/src/testing/testing.go:1249 +0x43f
  main.main()
      _testmain.go:428 +0x337

Goroutine 13 (running) created at:
  github.com/algorand/go-algorand/ledger.bqInit()
      /opt/cibuild/project/ledger/blockqueue.go:72 +0x412
  github.com/algorand/go-algorand/ledger.(*Ledger).reloadLedger()
      /opt/cibuild/project/ledger/ledger.go:186 +0x149
  github.com/algorand/go-algorand/ledger.OpenLedger()
      /opt/cibuild/project/ledger/ledger.go:160 +0xf84
  github.com/algorand/go-algorand/ledger.TestAppEmptyAccountsGlobal()
      /opt/cibuild/project/ledger/applications_test.go:734 +0x696
  testing.tRunner()
      /opt/cibuild/.gimme/versions/go1.14.7.linux.amd64/src/testing/testing.go:1039 +0x1eb
==================
    testing.go:954: race detected during execution of test
--- FAIL: TestAppEmptyAccountsGlobal (0.17s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants