Sometimes when shutting down the database is corrupted.
It's proving to be hard to recreate but when I saw this occur the stack trace in the previous execution of the app indicated a nil
pointer error in converter.BlockToRosettaBlock
.
The nil
pointer error doesn't seem to occur during normal execution.
2022-03-17T06:30:33.380+1100 DEBUG indexer indexer/indexer.go:415 block seen {"hash": "098af34d932f123
ce412d8640e3fa2b31b88e4c973def7fda16d01d4804b2c0f", "index": 1705}
2022-03-17T06:30:33.381+1100 DEBUG indexer indexer/indexer.go:306 block added {"hash": "098af34d932f123ce412d8640e3fa2b31b88e4c973def7fda16d01d4804b2c0
f", "index": 1705, "transactions": 1, "ops": 3}
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x7ff6b1603646]
goroutine 60 [running]:
github.com/ross-weir/rosetta-ergo/pkg/rosetta.(*BlockConverter).BlockToRosettaBlock(0xc00007ede0, {0x7ff6b1c457b8, 0xc00007c900}, 0x0)
V:/Development/rosetta-ergo/pkg/rosetta/converter.go:43 +0x46
github.com/ross-weir/rosetta-ergo/pkg/indexer.(*Indexer).Block(0xc00007ede0, {0x7ff6b1c457b8, 0xc00007c900}, 0xc006a8a200, 0xc006ba4370)
V:/Development/rosetta-ergo/pkg/indexer/indexer.go:208 +0x2f0
github.com/coinbase/rosetta-sdk-go/syncer.(*Syncer).fetchBlockResult(0xc000593d40, {0x7ff6b1c457b8, 0xc00007c900}, 0xc006878cf0, 0x6aa)
C:/Users/Ross/go/pkg/mod/github.com/coinbase/[email protected]/syncer/syncer.go:252 +0xae
github.com/coinbase/rosetta-sdk-go/syncer.(*Syncer).processBlocks(0xc000593d40, {0x7ff6b1c457b8, 0xc00007c900}, 0x20, 0xacc8d)
C:/Users/Ross/go/pkg/mod/github.com/coinbase/[email protected]/syncer/syncer.go:355 +0xc5
github.com/coinbase/rosetta-sdk-go/syncer.(*Syncer).sequenceBlocks(0xc000593d40, {0x7ff6b1c457b8, 0xc00007c900}, {0x7ff6b1c457b8, 0xc0059f4a00}, 0xc00015a580, 0x
c000035140, 0xc0000351a0, 0x0)
C:/Users/Ross/go/pkg/mod/github.com/coinbase/[email protected]/syncer/syncer.go:485 +0x16f
github.com/coinbase/rosetta-sdk-go/syncer.(*Syncer).syncRange(0xc000593d40, {0x7ff6b1c457b8, 0xc00007c900}, 0xacc8d)
C:/Users/Ross/go/pkg/mod/github.com/coinbase/[email protected]/syncer/syncer.go:584 +0x35b
github.com/coinbase/rosetta-sdk-go/syncer.(*Syncer).Sync(0xc000593d40, {0x7ff6b1c457b8, 0xc00007c900}, 0x695, 0xffffffffffffffff)
C:/Users/Ross/go/pkg/mod/github.com/coinbase/[email protected]/syncer/syncer.go:649 +0x1f3
github.com/ross-weir/rosetta-ergo/pkg/indexer.(*Indexer).Sync(0xc00007ede0, {0x7ff6b1c457b8, 0xc00007c900})
V:/Development/rosetta-ergo/pkg/indexer/indexer.go:162 +0x446
github.com/ross-weir/rosetta-ergo/cmd.startOnlineDependencies.func1()
V:/Development/rosetta-ergo/cmd/run.go:100 +0x25
golang.org/x/sync/errgroup.(*Group).Go.func1()
C:/Users/Ross/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x67
created by golang.org/x/sync/errgroup.(*Group).Go
C:/Users/Ross/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x92