koinos / koinos-block-store

The block store microservice saves blocks to disk and provides an API to the Koinos cluster via RPC over AMQP.
MIT License
1 stars 1 forks source link

[BUG]: panic: runtime error #98

Closed mvandeberg closed 3 years ago

mvandeberg commented 3 years ago

Is there an existing issue for this?

Current behavior

I restarted my block store and it immediately died with the following message:

2021-10-28 23:06:48.312888 (block_store.Koinos) [koinos-block-store/main.go:79] <info>: Opening database at /koinos/block_store/db

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

goroutine 1 [running]:
github.com/dgraph-io/badger.(*DB).Close(0x0, 0xc000026318, 0x0)
/go/pkg/mod/github.com/dgraph-io/badger@v1.6.2/db.go:362 +0x2e
github.com/koinos/koinos-block-store/internal/bstore.(*BadgerBackend).Close(0xc0000101d8)
/koinos-block-store/internal/bstore/badger_backend.go:24 +0x2e
panic(0x940000, 0xd66610)
/usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/dgraph-io/badger.(*DB).View(0x0, 0xc000165a60, 0x0, 0x0)
/go/pkg/mod/github.com/dgraph-io/badger@v1.6.2/txn.go:676 +0x3b
github.com/koinos/koinos-block-store/internal/bstore.(*BadgerBackend).Get(0xc0000101d8, 0xc0000294a0, 0x1, 0x1, 0x40fb58, 0xd7ba60, 0x0, 0xc000165b00, 0x40fb58
/koinos-block-store/internal/bstore/badger_backend.go:45 +0x9
github.com/koinos/koinos-block-store/internal/bstore.(*RequestHandler).GetHighestBlock(0xc000176100, 0xc000165d60, 0xc000026318, 0x16, 0x1)
/koinos-block-store/internal/bstore/reqhandler.go:467 +0x66
main.main()
/koinos-block-store/cmd/koinos-block-store/main.go:100 +0xbcf

Expected behavior

When I restart the block store, it should not die.

Steps to reproduce

I was running block store as the docker image.

Environment

- OS: Mac OS

Anything else?

No response