planetdecred / godcr

ISC License
86 stars 46 forks source link

Godcr crashes after wallet is deleted. #741

Closed crux25 closed 2 years ago

crux25 commented 2 years ago

If all the wallet on the app are deleted, navigating to Overview/Stake page carshes the application with the following error. `2021-12-31 06:52:55.171 [INF] DLWL: Loaded 1 wallets 2021-12-31 06:52:56.370 [INF] DLWL: Opened wallet 2021-12-31 06:54:02.386 [INF] DLWL: The wallet has been unlocked without a time limit 2021-12-31 06:54:02.386 [INF] DLWL: Closed wallet 2021-12-31 06:54:02.386 [INF] DLWL: tx db closed successfully 2021-12-31 06:54:02.386 [INF] DLWL: Deleting Wallet panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xee5688]

goroutine 7 [running]: github.com/planetdecred/dcrlibwallet.(MultiWallet).NextTicketPriceRemaining(0xc00034d600) /home/testuser/go/pkg/mod/github.com/planetdecred/dcrlibwallet@v1.6.2-0.20211208155954-3ba1589ff83f/ticket.go:188 +0x48 github.com/planetdecred/godcr/ui/page/staking.(Page).stakePriceSection.func1.1.1.3({{{0x0, 0x0}, {0x1c0, 0x1ec}}, {0x3f800000, 0x3f800000}, {0x1bb61a0, 0xc000359298}, {0xc06bc4a6b1a8892c, 0x1774d680f4, ...}, ...}) /home/testuser/go/src/github.com/planetdecred/godcr/ui/page/staking/overview.go:215 +0x46 gioui.org/layout.Flex.Layout({0x68, 0xcf, 0xb9, 0xc0}, {{{0x21c, 0x0}, {0x21c, 0x1ec}}, {0x3f800000, 0x3f800000}, ...}, ...) /home/testuser/go/pkg/mod/gioui.org@v0.0.0-20211011183043-05f0f5c20f45/layout/flex.go:99 +0xd75 github.com/planetdecred/godcr/ui/page/staking.(Page).stakePriceSection.func1.1.1({{{0x21c, 0x0}, {0x21c, 0x1ec}}, {0x3f800000, 0x3f800000}, {0x1bb61a0, 0xc000359298}, {0xc06bc4a6b1a8892c, 0x1774d680f4, ...}, ...}) /home/testuser/go/src/github.com/planetdecred/godcr/ui/page/staking/overview.go:196 +0x2b4 gioui.org/layout.Inset.Layout({{0x3270, 0x0}, {0xa7, 0x0}, {0xf42d0, 0xc0}, {0x89, 0x0}}, {{{0x21c, 0x0}, ...}, ...}, ...) /home/testuser/go/pkg/mod/gioui.org@v0.0.0-20211011183043-05f0f5c20f45/layout/layout.go:146 +0x416 github.com/planetdecred/godcr/ui/page/staking.(Page).stakePriceSection.func1.1({{{0x21c, 0x0}, {0x21c, 0x1f7}}, {0x3f800000, 0x3f800000}, {0x1bb61a0, 0xc000359298}, {0xc06bc4a6b1a8892c, 0x1774d680f4, ...}, ...}) /home/amos/go/src/github.com/planetdecred/godcr/ui/page/staking/overview.go:194 +0xaf gioui.org/layout.Flex.Layout({0x9b, 0x0, 0x0, 0x0}, {{{0x21c, 0x0}, {0x21c, 0x1f7}}, {0x3f800000, 0x3f800000}, ...}, ...) /home/testuser/go/pkg/mod/gioui.org@v0.0.0-20211011183043-05f0f5c20f45/layout/flex.go:99 +0xd75 github.com/planetdecred/godcr/ui/page/staking.(*Page).stakePriceSection.func1({{{0x21c, 0x0}, {0x21c, 0x1f7}}, {0x3f800000, 0x3f800000}, {0x1bb61a0, 0xc000359298}, {0xc06bc4a6b1a8892c, 0x1774d680f4, ...}, ...}) `

dreacot commented 2 years ago

we have another similar issue here https://github.com/planetdecred/godcr/issues/680, i see the log of this issue is different though, can you share steps on how to reproduce this error?

crux25 commented 2 years ago

The issues looks similar, though step to reproduce differs. Step to reproduce:

  1. Delete all the wallet on the APP.
  2. Navigate to overview page/stake page and APP crashes, It happens consistently I was able to reproduce multiple times. I suspect other pages that needs access to the wallet will crash it too.
dreacot commented 2 years ago

Oh okay, then the issue should be an easy fix, ideally, deleting all wallets on the app should take you to the apps's welcome screen

So once all wallets are deleted, a check should be carried out, something similar to if len(wallets) = 0 {showSplashScreen()}

crux25 commented 2 years ago

That's my thought. But hard to say except issue is investigated. Looking at #680 crash log, its likely a fix for this will fix it.

Sirmorrison commented 2 years ago

The issues are exactly the same. Just different actions that need to query dcrlibwallet with a wallet account that s no longer available since they are all deleted.

Sirmorrison commented 2 years ago

Closes #680