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

gomod: update btcwallet re rescan race fix #8094

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

yyforyongyu
Copy link
Member

There's a race found in this build,

==================
WARNING: DATA RACE
Read at 0x00c000884f24 by goroutine 1421:
  github.com/btcsuite/btcd/chaincfg/chainhash.(*Hash).String()
      <autogenerated>:1 +0x44
  fmt.(*pp).handleMethods()
      /opt/hostedtoolcache/go/1.21.0/x64/src/fmt/print.go:673 +0x4b6
  fmt.(*pp).printArg()
      /opt/hostedtoolcache/go/1.21.0/x64/src/fmt/print.go:756 +0xcce
  fmt.(*pp).doPrintf()
      /opt/hostedtoolcache/go/1.21.0/x64/src/fmt/print.go:1077 +0x58f
  fmt.Fprintf()
      /opt/hostedtoolcache/go/1.21.0/x64/src/fmt/print.go:224 +0x78
  github.com/btcsuite/btclog.(*Backend).printf()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/log.go:305 +0x264
  github.com/btcsuite/btclog.(*slog).Infof()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/log.go:391 +0xd8
  github.com/btcsuite/btcwallet/wallet.(*Wallet).rescanProgressHandler()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/rescan.go:214 +0x606
  github.com/btcsuite/btcwallet/wallet.(*Wallet).SynchronizeRPC.func3()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/wallet.go:223 +0x33

Previous write at 0x00c000884f24 by goroutine 1427:
  github.com/lightninglabs/neutrino.(*rescanState).rescan()
      /home/runner/go/pkg/mod/github.com/lightninglabs/[email protected]/rescan.go:759 +0x1514
  github.com/lightninglabs/neutrino.(*Rescan).Start.func1()
      /home/runner/go/pkg/mod/github.com/lightninglabs/[email protected]/rescan.go:1405 +0x256

Goroutine 1421 (running) created at:
  github.com/btcsuite/btcwallet/wallet.(*Wallet).SynchronizeRPC()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/wallet.go:223 +0x387
  github.com/lightningnetwork/lnd/lnwallet/btcwallet.(*BtcWallet).Start()
      /home/runner/work/lnd/lnd/lnwallet/btcwallet/btcwallet.go:447 +0xd73
  github.com/lightningnetwork/lnd/lnwallet.(*LightningWallet).Startup()
      /home/runner/work/lnd/lnd/lnwallet/wallet.go:440 +0x6e
  github.com/lightningnetwork/lnd/lnwallet/test.createTestWallet()
      /home/runner/work/lnd/lnd/lnwallet/test/test_interface.go:373 +0x70b
  github.com/lightningnetwork/lnd/lnwallet/test.runTests()
      /home/runner/work/lnd/lnd/lnwallet/test/test_interface.go:3434 +0x3c99
  github.com/lightningnetwork/lnd/lnwallet/test.TestLightningWallet()
      /home/runner/work/lnd/lnd/lnwallet/test/test_interface.go:3092 +0xcce
  github.com/lightningnetwork/lnd/lnwallet/test/neutrino_test.TestLightningWallet()
      /home/runner/work/lnd/lnd/lnwallet/test/neutrino/neutrino_test.go:12 +0x32
  testing.tRunner()
      /opt/hostedtoolcache/go/1.21.0/x64/src/testing/testing.go:1595 +0x238
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.21.0/x64/src/testing/testing.go:1648 +0x44

Goroutine 1427 (running) created at:
  github.com/lightninglabs/neutrino.(*Rescan).Start()
      /home/runner/go/pkg/mod/github.com/lightninglabs/[email protected]/rescan.go:1399 +0x11c
  github.com/btcsuite/btcwallet/chain.(*NeutrinoClient).Rescan()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/chain/neutrino.go:470 +0x14ed
  github.com/btcsuite/btcwallet/wallet.(*Wallet).rescanRPCHandler()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/rescan.go:257 +0x49e
  github.com/btcsuite/btcwallet/wallet.(*Wallet).SynchronizeRPC.func4()
      /home/runner/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/wallet.go:224 +0x33
==================

Turns out there's concurrent access to the RescanProgress message,

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎂

@Roasbeef Roasbeef merged commit 9bdbd79 into lightningnetwork:master Oct 18, 2023
@yyforyongyu yyforyongyu deleted the fix-rescan-race branch October 19, 2023 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants