gcash / bchd

An alternative full node bitcoin cash implementation written in Go (golang)
ISC License
280 stars 101 forks source link

panic runtime error when starting #503

Closed Azulan closed 2 years ago

Azulan commented 2 years ago

After an unattended shutdown of the machine while running the client, the bchd process gives this error output when run. It gives the following error on the current release version.

PS D:\BCHD> .\bchd.exe
2022-05-07 02:24:27.067 [INF] BCHD: Version 0.19.0
2022-05-07 02:24:27.068 [INF] BCHD: Loading block database from 'R:\bchd\data\mainnet\blocks_ffldb'
2022-05-07 02:24:27.367 [INF] BCHD: Block database loaded
2022-05-07 02:24:27.379 [INF] INDX: Committed filter index is enabled
2022-05-07 02:24:27.380 [INF] CHAN: Loading block index...
2022-05-07 02:24:29.749 [INF] CHAN: Reconstructing UTXO state after unclean shutdown. This may take a long time...
2022-05-07 02:24:29.827 [INF] BCHD: Gracefully shutting down the database...
2022-05-07 02:24:29.827 [INF] BCHD: Database has gracefully shutdown
2022-05-07 02:24:29.827 [INF] BCHD: Shutdown complete
2022-05-07 02:24:29.827 [INF] BCHD: Closing: logRotator
2022-05-07 02:24:29.827 [INF] BCHD: Closed: logRotator
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x30 pc=0x1382171]

goroutine 1 [running]:
github.com/gcash/bchd/blockchain.(*utxoCache).InitConsistentState(0xc00021e360, 0xc00efdd880, 0x0, 0xc00024d0f8?)
        /home/quest/go/src/github.com/gcash/bchd/blockchain/utxocache.go:724 +0x571
github.com/gcash/bchd/blockchain.New(0xc00024d8d0)
        /home/quest/go/src/github.com/gcash/bchd/blockchain/chain.go:2300 +0x831
main.newServer({0xc000235e50, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1b5c2f8, ...}, ...)
        /home/quest/go/src/github.com/gcash/bchd/server.go:3233 +0x13dd
main.bchdMain(0x0)
        /home/quest/go/src/github.com/gcash/bchd/bchd.go:164 +0x7ec
main.main()
        /home/quest/go/src/github.com/gcash/bchd/bchd.go:351 +0xa5

It gave this output on the previous release version.

PS D:\BCHD> .\bchd.conf
2022-05-07 01:56:01.615 [INF] BCHD: Version 0.18.1
2022-05-07 01:56:01.616 [INF] BCHD: Loading block database from 'R:\bchd\data\mainnet\blocks_ffldb'
2022-05-07 01:56:01.920 [INF] BCHD: Block database loaded
2022-05-07 01:56:01.930 [INF] INDX: Transaction index is enabled
2022-05-07 01:56:01.930 [INF] INDX: Address index is enabled
2022-05-07 01:56:01.930 [INF] INDX: Committed filter index is enabled
2022-05-07 01:56:01.930 [INF] CHAN: Loading block index...
2022-05-07 01:56:04.544 [INF] CHAN: Reconstructing UTXO state after unclean shutdown. This may take a long time...
2022-05-07 01:56:04.643 [INF] BCHD: Gracefully shutting down the database...
2022-05-07 01:56:04.653 [INF] BCHD: Shutdown complete
2022-05-07 01:56:04.653 [INF] BCHD: Closing: logRotator
2022-05-07 01:56:04.653 [INF] BCHD: Closed: logRotator
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x30 pc=0x9b14ff]

goroutine 1 [running]:
github.com/gcash/bchd/blockchain.(*utxoCache).InitConsistentState(0xc00037c000, 0xc00e91b180, 0x0, 0xc0000343c0, 0x3, 0x3)
        /home/travis/gopath/src/github.com/gcash/bchd/blockchain/utxocache.go:724 +0x4df
github.com/gcash/bchd/blockchain.New(0xc0003658e0, 0x1c, 0x1c, 0x0)
        /home/travis/gopath/src/github.com/gcash/bchd/blockchain/chain.go:2300 +0x6fd
main.newServer(0xc0004d3e90, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1266ab8, ...)
        /home/travis/gopath/src/github.com/gcash/bchd/server.go:3233 +0xaa9
main.bchdMain(0x0, 0x0, 0x0)
        /home/travis/gopath/src/github.com/gcash/bchd/bchd.go:164 +0x799
main.main()
        /home/travis/gopath/src/github.com/gcash/bchd/bchd.go:351 +0xe8

I have a Process Monitor .pml file of the run if that would be useful.

cpacia commented 2 years ago

What options are you using when runninng it. The panic appears to be related to rebuilding the utxo set. If you pruned the chain this may not be possible.

Azulan commented 2 years ago

No prune, dbcache=2048, txindex and addrindex are both 1.

Azulan commented 2 years ago

Most likely issue was caused by a failing raid array. Closing.