decred / dcrwallet

A secure Decred wallet daemon written in Go (golang).
https://decred.org
ISC License
216 stars 155 forks source link

switchToSideChain panic on testnet #688

Closed jolan closed 7 years ago

jolan commented 7 years ago

From @girino:

panic: runtime error: makeslice: len out of range

goroutine 26 [running]:
panic(0xaec0c0, 0xc420c33cc0)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/decred/dcrwallet/wallet.(*Wallet).switchToSideChain(0xc4201bc000, 0x1098ec0, 0xc4200243d0, 0xc4209fa801, 0x2, 0x2)
        /home/testnet/go/src/github.com/decred/dcrwallet/wallet/chainntfns.go:164 +0x1f3
github.com/decred/dcrwallet/wallet.(*Wallet).onBlockConnected(0xc4201bc000, 0x1098ec0, 0xc4200243d0, 0xc420410780, 0xb4, 0xb4, 0x1106af8, 0x0, 0x0, 0x0, ...)
        /home/testnet/go/src/github.com/decred/dcrwallet/wallet/chainntfns.go:248 +0x546
github.com/decred/dcrwallet/wallet.(*Wallet).handleConsensusRPCNotifications.func1(0x1098ec0, 0xc4200243d0, 0xc4200243d0, 0x0)
        /home/testnet/go/src/github.com/decred/dcrwallet/wallet/chainntfns.go:37 +0x7e
github.com/decred/dcrwallet/walletdb.Update(0x1097020, 0xc42046a5a0, 0xc420115ed8, 0xc420115ea8, 0x1)
        /home/testnet/go/src/github.com/decred/dcrwallet/walletdb/interface.go:219 +0x6f
github.com/decred/dcrwallet/wallet.(*Wallet).handleConsensusRPCNotifications(0xc4201bc000, 0xc420896770)
        /home/testnet/go/src/github.com/decred/dcrwallet/wallet/chainntfns.go:38 +0x3e0
github.com/decred/dcrwallet/wallet.(*Wallet).handleChainNotifications(0xc4201bc000, 0xc420896770)
        /home/testnet/go/src/github.com/decred/dcrwallet/wallet/chainntfns.go:99 +0x6a
created by github.com/decred/dcrwallet/wallet.(*Wallet).SynchronizeRPC
        /home/testnet/go/src/github.com/decred/dcrwallet/wallet/wallet.go:579 +0x1a1
girino commented 7 years ago

just adding a little bit of context. My wallet hung on testnet2 while executing "getstakeinfo". Error message was "-4: the wallet is currently syncing to the best block, please try again later". After a retrying "getstakeinfo" a few times, dcrwallet crashed with the above trace.

Wallet is compiled from source with "go version go1.7.5 linux/amd64". last commit: a642114a124c6174130d528d9d33fe69128d2688

This is "stakepool" wallet, the machine runs dcrd, dcrwallet and stakepoold.

meany commented 7 years ago

i have a similar issue - mainnet / deserializeSStxRecord. this occurs after upgrade to 1.0.1


panic: runtime error: makeslice: len out of range
goroutine 1 [running]:
panic(0xaec0e0, 0xc42000dac0)
/home/jcv/code/golang/src/runtime/panic.go:500 +0x1a1
github.com/decred/dcrwallet/wallet/udb.deserializeSStxRecord(0x7fc87914b2fa, 0x189, 0x189, 0x2, 0x7fc87914b2fa, 0x189, 0x189)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/stakedb.go:124 +0x40d
github.com/decred/dcrwallet/wallet/udb.fetchSStxRecord(0x7fc887008eb8, 0xc42016fd40, 0xc420180ce0, 0x7fc800000002, 0xc42016fd40, 0x189, 0x189)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/stakedb.go:562 +0xd4
github.com/decred/dcrwallet/wallet/udb.votingPreferencesUpgrade(0x1099ee0, 0xc42001e1c0, 0xc420107320, 0x24, 0x30, 0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/upgrades.go:246 +0x319
github.com/decred/dcrwallet/wallet/udb.Upgrade.func2(0x1099ee0, 0xc42001e1c0, 0xc42001e1c0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/upgrades.go:302 +0xac
github.com/decred/dcrwallet/walletdb.Update(0x1098040, 0xc4204a0780, 0xc4204e5990, 0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/walletdb/interface.go:219 +0x6f
github.com/decred/dcrwallet/wallet/udb.Upgrade(0x1098040, 0xc4204a0780, 0xc420107320, 0x24, 0x30, 0xc420413e10, 0xc420413e00)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/udb/upgrades.go:308 +0x275
github.com/decred/dcrwallet/wallet.Open(0x1098040, 0xc4204a0780, 0xc420107320, 0x24, 0x30, 0x1000101, 0xc42041c60e, 0x23, 0xc4204f3b9c, 0x23, ...)
/home/jcv/code/go/src/github.com/decred/dcrwallet/wallet/wallet.go:3720 +0xf8
github.com/decred/dcrwallet/loader.(*Loader).OpenExistingWallet(0xc42049c820, 0xc420107320, 0x24, 0x30, 0x1, 0x0, 0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/loader/loader.go:219 +0x477
main.walletMain(0x0, 0x0)
/home/jcv/code/go/src/github.com/decred/dcrwallet/dcrwallet.go:126 +0x76e
main.main()
/home/jcv/code/go/src/github.com/decred/dcrwallet/dcrwallet.go:38 +0x32
jrick commented 7 years ago

@meany please open a new issue for that, that looks like a different bug entirely

jrick commented 7 years ago

This looks like #525. @girino can you read my comment there and determine if this is what was happening in this case?

girino commented 7 years ago

well, the logs previous to the panic look similar, so this might be the same problem, triggered by different api calls:

01:23:17 2017-04-27 [INF] WLLT: Connecting block 00000000039012b6a731c3280ea7049459ded7a3d584b7d940d9f51ec6099ba4, height 30918
01:23:17 2017-04-27 [ERR] WLLT: Failed to process consensus server notification (name: `blockconnected`, detail: `header is not a direct child of the current tip block`)
01:24:35 2017-04-27 [INF] WLLT: Reorganization detected!
jrick commented 7 years ago

Ah ok, yeah same issue. I'll close this one and let's move discussion into the other. If you have suggestions as to what to do, comment there.