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

Gaiad export fails with nil pointer dereference #1799

Closed
4 tasks
UnitylChaos opened this issue Jul 23, 2018 · 1 comment · Fixed by #1800
Closed
4 tasks

Gaiad export fails with nil pointer dereference #1799

UnitylChaos opened this issue Jul 23, 2018 · 1 comment · Fixed by #1800
Labels

Comments

@UnitylChaos
Copy link
Contributor

Summary of Bug

gaiad export on v0.22.0 / gaia-7001 fails with the following error.

root@gaia:~# gaiad export
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x9a2e6e]

goroutine 1 [running]:
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).NewContext(0xc42047a180, 0xfd6501, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /root/go/src/github.com/cosmos/cosmos-sdk/baseapp/baseapp.go:232 +0x5e
github.com/cosmos/cosmos-sdk/cmd/gaia/app.(*GaiaApp).ExportAppStateAndValidators(0xc4200e3ba0, 0xc420a31660, 0xfd85a0, 0xc42000e090, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/app.go:184 +0x6a
main.exportAppStateAndTMValidators(0xfcff00, 0xc420a31660, 0xfd85a0, 0xc42000e090, 0x0, 0x0, 0x0, 0x0, 0xc420aeba88, 0xa23437, ...)
        /root/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad/main.go:53 +0x86
github.com/cosmos/cosmos-sdk/server.ConstructAppExporter.func1(0xc4209555f0, 0xc, 0xfcff00, 0xc420a31660, 0x0, 0x0, 0x997550, 0xcc61c0, 0x0, 0xe15c8e, ...)
        /root/go/src/github.com/cosmos/cosmos-sdk/server/constructors.go:82 +0x14c
github.com/cosmos/cosmos-sdk/server.ExportCmd.func1(0xc420aa2900, 0x1709808, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/github.com/cosmos/cosmos-sdk/server/export.go:23 +0xf9
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).execute(0xc420aa2900, 0x1709808, 0x0, 0x0, 0xc420aa2900, 0x1709808)
        /root/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:698 +0x46d
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200c9440, 0xcfa2c0, 0xc4200f3e01, 0xc420a313a0)
        /root/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:783 +0x2e4
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200c9440, 0xc420a313a0, 0xc4200f3ed8)
        /root/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:736 +0x2b
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli.Executor.Execute(0xc4200c9440, 0xf53810, 0x2, 0xc4209555f0)
        /root/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli/setup.go:89 +0x4e
main.main()
        /root/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad/main.go:38 +0x214

After talking with @AdityaSripal we've traced the issue to app.setCheckState not being called on the gaia app that is created for export. This can be fixed by adding that call to the end of app.initFromStore, will submit a PR to that effect.

Steps to Reproduce

Call gaiad export with gaiad on v0.22.0


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@UnitylChaos UnitylChaos mentioned this issue Jul 23, 2018
9 tasks
@AdityaSripal
Copy link
Member

setCheckState used to be called in initFromStore, it got moved to InitChain
This change was made in PR: #1367

The only other alternative I see to fixing this, is to call app.InitChain with empty JSON to avoid having gaia's app.initChainer from modifying any state. When we tried to pass {} into AppStateBytes, we got a sanity check error in stake.InitGenesis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants