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

runtime error: invalid memory address or nil pointer dereference | in indexers.dbStoreFilterIdxEntry #1286

Closed
darwin opened this issue Sep 11, 2018 · 2 comments

Comments

@darwin
Copy link
Contributor

darwin commented Sep 11, 2018

It looks like my database got corrupted and it prevents btcd from launching.

Yesterday I upgraded my btcd node to current master and let it convert utxo database to v2 over night. Today I came and noticed this problem. Previous version was a @Roasbeef's lnd-copmpatible checkout sometime from March this year.

Any ideas how to recover without downloading the whole blockchain again?

I'm running my node on a DigitalOcean VPS with Ubuntu 18.04 in a docker container with a config modelled after: https://github.com/lightningnetwork/lnd/tree/master/docker.

btcd    | 2018-09-11 11:34:53.879 [INF] CMGR: DNS discovery failed on seed seed.bitcoin.jonasschnelli.ch: lookup seed.bitcoin.jonasschnelli.ch on 127.0.0.11:53: server misbehaving
btcd    | panic: runtime error: invalid memory address or nil pointer dereference [recovered]
btcd    | 	panic: runtime error: invalid memory address or nil pointer dereference
btcd    | [signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x785303]
btcd    |
btcd    | goroutine 29 [running]:
btcd    | github.com/btcsuite/btcd/database/ffldb.rollbackOnPanic(0xc420021200)
btcd    | 	/go/src/github.com/btcsuite/btcd/database/ffldb/db.go:1831 +0x77
btcd    | panic(0x99ff60, 0xeb1680)
btcd    | 	/usr/local/go/src/runtime/panic.go:502 +0x229
btcd    | github.com/btcsuite/btcd/blockchain/indexers.dbStoreFilterIdxEntry(0xc02280, 0xc420021200, 0xe82e50, 0x10, 0x10, 0xc4284620c0, 0xc432ac3540, 0x20, 0x20, 0x0, ...)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/indexers/cfindex.go:68 +0xb3
btcd    | github.com/btcsuite/btcd/blockchain/indexers.storeFilter(0xc02280, 0xc420021200, 0xc428382930, 0xc4207915f0, 0xc420791500, 0x0, 0x0)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/indexers/cfindex.go:179 +0x2b1
btcd    | github.com/btcsuite/btcd/blockchain/indexers.(*CfIndex).ConnectBlock(0xc4200f23c0, 0xc02280, 0xc420021200, 0xc428382930, 0xc4302f0000, 0x1622, 0x1622, 0x0, 0x0)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/indexers/cfindex.go:225 +0x1b7
btcd    | github.com/btcsuite/btcd/blockchain/indexers.dbIndexConnectBlock(0xc02280, 0xc420021200, 0xbffe80, 0xc4200f23c0, 0xc428382930, 0xc4302f0000, 0x1622, 0x1622, 0x0, 0x0)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/indexers/manager.go:89 +0x142
btcd    | github.com/btcsuite/btcd/blockchain/indexers.(*Manager).ConnectBlock(0xc420366030, 0xc02280, 0xc420021200, 0xc428382930, 0xc4302f0000, 0x1622, 0x1622, 0x0, 0xc423897850)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/indexers/manager.go:508 +0xc4
btcd    | github.com/btcsuite/btcd/blockchain.(*BlockChain).connectBlock.func1(0xc02280, 0xc420021200, 0xc420021200, 0x0)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/chain.go:644 +0x1fb
btcd    | github.com/btcsuite/btcd/database/ffldb.(*db).Update(0xc420062480, 0xc422ae0780, 0x0, 0x0)
btcd    | 	/go/src/github.com/btcsuite/btcd/database/ffldb/db.go:1888 +0x9b
btcd    | github.com/btcsuite/btcd/blockchain.(*BlockChain).connectBlock(0xc4204acd80, 0xc4285692d0, 0xc428382930, 0xc4237623c0, 0xc4302f0000, 0x1622, 0x1622, 0xc42fe36000, 0xc42c4f99c0)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/chain.go:611 +0x323
btcd    | github.com/btcsuite/btcd/blockchain.(*BlockChain).connectBestChain(0xc4204acd80, 0xc4285692d0, 0xc428382930, 0x0, 0x0, 0x0, 0xc42c4f9ad8)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/chain.go:1145 +0x1f8
btcd    | github.com/btcsuite/btcd/blockchain.(*BlockChain).maybeAcceptBlock(0xc4204acd80, 0xc428382930, 0xffffffff00000000, 0x0, 0x0, 0xec66c0)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/accept.go:79 +0x207
btcd    | github.com/btcsuite/btcd/blockchain.(*BlockChain).ProcessBlock(0xc4204acd80, 0xc428382930, 0xc400000000, 0xc42ab70000, 0x0, 0x0)
btcd    | 	/go/src/github.com/btcsuite/btcd/blockchain/process.go:228 +0x2b5
btcd    | github.com/btcsuite/btcd/netsync.(*SyncManager).handleBlockMsg(0xc4200b6580, 0xc42f69c860)
btcd    | 	/go/src/github.com/btcsuite/btcd/netsync/manager.go:569 +0x205
btcd    | github.com/btcsuite/btcd/netsync.(*SyncManager).blockHandler(0xc4200b6580)
btcd    | 	/go/src/github.com/btcsuite/btcd/netsync/manager.go:1166 +0x548
btcd    | created by github.com/btcsuite/btcd/netsync.(*SyncManager).Start
btcd    | 	/go/src/github.com/btcsuite/btcd/netsync/manager.go:1388 +0xe3
@darwin
Copy link
Contributor Author

darwin commented Sep 12, 2018

Just to add. I was able to work around the issue by starting btcd with --nocfilters flag.

Before I also tried to --droptxindex a let btcd to index all transactions again - but that didn't fix the issue.

@Roasbeef
Copy link
Member

Note that the developers of lnd are not the owners of that Docker Hub account. I'd recommend instead building btcd yourself locally. If you were using my fork of btcd (the roasbeef fork), then the on disk format of the index has changed in the current version of master. As a result, in order to update, you need to drop the old index and start from scratch.

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

No branches or pull requests

2 participants