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

Segfault when doing fast forward receipt download #1920

Closed
diwu1989 opened this issue Jul 9, 2022 · 1 comment · Fixed by #2036
Closed

Segfault when doing fast forward receipt download #1920

diwu1989 opened this issue Jul 9, 2022 · 1 comment · Fixed by #2036
Assignees

Comments

@diwu1989
Copy link
Contributor

diwu1989 commented Jul 9, 2022

Using latest stable version 1.5.5, hitting this segfault:

ERROR[07-09|06:27:16.927] Invalid block total difficulty RLP       hash=64c1b1..9023d4 err="rlp: value size exceeds available input length"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5275a5]

goroutine 4480 [running]:
math/big.(*Int).Cmp(0xa8f8b6642b0a06f1?, 0xa1e5406221dd63db?)
        math/big/int.go:328 +0x25
github.com/celo-org/celo-blockchain/core.(*BlockChain).InsertReceiptChain.func1(0xc0426d1a80)
        github.com/celo-org/celo-blockchain/core/blockchain.go:1198 +0x4b7
github.com/celo-org/celo-blockchain/core.(*BlockChain).InsertReceiptChain.func3({0xc043932000, 0x8d, 0x84b67016ef55ac58?}, {0xc043938000, 0x8d, 0x0?})
        github.com/celo-org/celo-blockchain/core/blockchain.go:1372 +0x812
github.com/celo-org/celo-blockchain/core.(*BlockChain).InsertReceiptChain(0xc0003e9000, {0xc023e65b00, 0x8d, 0x4?}, {0xc0426a8000, 0x8d, 0xa?}, 0x0)
        github.com/celo-org/celo-blockchain/core/blockchain.go:1398 +0x1405
github.com/celo-org/celo-blockchain/eth/downloader.(*Downloader).commitFastSyncData(0xc0005e81e0, {0xc023e65680, 0x8d, 0x8a35f30fd616db9c?}, 0xc031373220)
        github.com/celo-org/celo-blockchain/eth/downloader/downloader.go:2088 +0x4e8
github.com/celo-org/celo-blockchain/eth/downloader.(*Downloader).processFastSyncContent(0xc0005e81e0)
        github.com/celo-org/celo-blockchain/eth/downloader/downloader.go:2004 +0x905
github.com/celo-org/celo-blockchain/eth/downloader.(*Downloader).syncWithPeer.func7()
        github.com/celo-org/celo-blockchain/eth/downloader/downloader.go:593 +0x1d
github.com/celo-org/celo-blockchain/eth/downloader.(*Downloader).spawnSync.func1()
        github.com/celo-org/celo-blockchain/eth/downloader/downloader.go:607 +0x70
created by github.com/celo-org/celo-blockchain/eth/downloader.(*Downloader).spawnSync
        github.com/celo-org/celo-blockchain/eth/downloader/downloader.go:607 +0x5f

Fix looks to be simple, just add nil checks:

			currentFastBlock, td := bc.CurrentFastBlock(), bc.GetTd(head.Hash(), head.NumberU64())
			fastBlockTd := bc.GetTd(currentFastBlock.Hash(), currentFastBlock.NumberU64())
			if fastBlockTd != nil && td != nil && fastBlockTd.Cmp(td) < 0 {
				rawdb.WriteHeadFastBlockHash(bc.db, head.Hash())
				bc.currentFastBlock.Store(head)
				headFastBlockGauge.Update(int64(head.NumberU64()))
				return true
			}
@diwu1989
Copy link
Contributor Author

diwu1989 commented Jul 9, 2022

Look similar to ethereum/go-ethereum#22281

@carterqw2 carterqw2 added triage Issue needs triaging and removed blockchain labels Feb 9, 2023
@carterqw2 carterqw2 added good first issue and removed triage Issue needs triaging labels Feb 20, 2023
karlb added a commit to karlb/celo-blockchain that referenced this issue Mar 7, 2023
@karlb karlb self-assigned this Mar 10, 2023
karlb added a commit that referenced this issue Mar 10, 2023
karlb added a commit that referenced this issue Mar 10, 2023
karlb added a commit that referenced this issue Mar 10, 2023
palango pushed a commit that referenced this issue Mar 10, 2023
gastonponti pushed a commit that referenced this issue Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants