Skip to content

Output error instead of panic when the given db_backend is not initialised #2371

@melekes

Description

@melekes
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1731dcc]

goroutine 1 [running]:
github.com/tendermint/tendermint/libs/db.NewDB(0x1a10ba9, 0xa, 0xc000182ee8, 0x8, 0xc00086be30, 0x9, 0xc000182e30, 0x10)
        /Users/antonk/go/src/github.com/tendermint/tendermint/libs/db/db.go:31 +0x8c
github.com/tendermint/tendermint/node.DefaultDBProvider(0xc000865be0, 0xc000865be0, 0x0, 0x0, 0x0)
        /Users/antonk/go/src/github.com/tendermint/tendermint/node/node.go:61 +0xc2
github.com/tendermint/tendermint/node.NewNode(0xc00084e5a0, 0x1c33480, 0xc0004b2f00, 0xc000883310, 0x1c26840, 0xc000865bc0, 0xc000883520, 0x1b6f660, 0xc000883530, 0x1c31e00, ...)
        /Users/antonk/go/src/github.com/tendermint/tendermint/node/node.go:158 +0xa6
github.com/tendermint/tendermint/node.DefaultNewNode(0xc00084e5a0, 0x1c31e00, 0xc000865760, 0x0, 0x1c31e80, 0xc000121b38)
        /Users/antonk/go/src/github.com/tendermint/tendermint/node/node.go:89 +0x25a
github.com/tendermint/tendermint/cmd/tendermint/commands.NewRunNodeCmd.func1(0xc0001d0000, 0xc000186e20, 0x0, 0x2, 0x0, 0x0)
        /Users/antonk/go/src/github.com/tendermint/tendermint/cmd/tendermint/commands/run_node.go:53 +0x5e
github.com/tendermint/tendermint/vendor/github.com/spf13/cobra.(*Command).execute(0xc0001d0000, 0xc000186de0, 0x2, 0x2, 0xc0001d0000, 0xc000186de0)
        /Users/antonk/go/src/github.com/tendermint/tendermint/vendor/github.com/spf13/cobra/command.go:698 +0x47a
github.com/tendermint/tendermint/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2311700, 0xc000186d40, 0xc000121e28, 0x13ece8d)
        /Users/antonk/go/src/github.com/tendermint/tendermint/vendor/github.com/spf13/cobra/command.go:783 +0x2dc
github.com/tendermint/tendermint/vendor/github.com/spf13/cobra.(*Command).Execute(0x2311700, 0x13ec742, 0xc00018b320)
        /Users/antonk/go/src/github.com/tendermint/tendermint/vendor/github.com/spf13/cobra/command.go:736 +0x2b
github.com/tendermint/tendermint/libs/cli.Executor.Execute(0x2311700, 0x1b71580, 0x2, 0xc000014440)
        /Users/antonk/go/src/github.com/tendermint/tendermint/libs/cli/setup.go:89 +0x4e
main.main()
        /Users/antonk/go/src/github.com/tendermint/tendermint/cmd/tendermint/main.go:45 +0x246

Steps to reproduce:

  1. Compile TM without cleveldb
  2. Change db_backend in config.toml to cleveldb
  3. Run TM

What did you expect:
Nicely formatted error (Unknown db_backend %s, expected either %v or ...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions