core-geth icon indicating copy to clipboard operation
core-geth copied to clipboard

debug.setHead lead to panic (*SyncBloom.Add)

Open meowsbits opened this issue 5 years ago • 0 comments

System information

> ./build/bin/geth version
CoreGeth
Version: 1.11.17-unstable
Git Commit: 03674af77969206efbb7cd009e84e02cb2c9dabc
Git Commit Date: 20201106
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.15
Operating System: linux
GOPATH=/home/ia/go
GOROOT=/home/ia/go1.15.linux-amd64

Expected behaviour

Does not panic, ever.

Actual behaviour

Panics during a debug.setHead call.

Steps to reproduce the behaviour

This shows the second call at this datadir to setHead. I interrupted the first one. Note the Truncating ancient chain log. Also note that I was running without --nodiscover, which may have dirtied things up.

> ./build/bin/geth --datadir /home/ia/SAMSUNG_T5/e/clients/core-geth/classic --ipcpath /tmp/geth.ipc --exec 'debug.setHead("0xa7d8c0")' console

INFO [11-06|05:49:06.695] Loaded most recent local fast block      number=11334808 hash="4069ee…6dad47" td=1024031133804038826964 age=1mo3d1h
INFO [11-06|05:49:06.696] Loaded last fast-sync pivot marker       number=11323806
ERROR[11-06|05:49:06.696] Truncating ancient chain                 from=11334808 to=11323806
INFO [11-06|05:50:06.320] Loaded most recent local header          number=11323806 hash="a32968…9deb38" td=1023509064443725411678 age=1mo4d17h
INFO [11-06|05:50:06.320] Loaded most recent local full block      number=11323806 hash="a32968…9deb38" td=1023509064443725411678 age=1mo4d17h
INFO [11-06|05:50:06.320] Loaded most recent local fast block      number=11323806 hash="a32968…9deb38" td=1023509064443725411678 age=1mo4d17h
INFO [11-06|05:50:06.320] Loaded last fast-sync pivot marker       number=11323806
INFO [11-06|05:50:06.323] Loaded local transaction journal         transactions=0 dropped=0
INFO [11-06|05:50:06.324] Regenerated local transaction journal    transactions=0 accounts=0
WARN [11-06|05:50:06.324] Switch sync mode from fast sync to full sync
INFO [11-06|05:50:06.325] Starting peer-to-peer node               instance=CoreGeth/v1.11.17-unstable-03674af7-20201106/linux-amd64/go1.15
INFO [11-06|05:50:06.413] New local node record                    seq=16 id=387f0da74d2ec69f ip=75.134.144.252 udp=30303 tcp=30303
INFO [11-06|05:50:06.413] Started P2P networking                   self=enode://a45b4f53c46922d67cc9bd7516e207c45a896ab86d3a86c5aa9f938d7f40ffa33fa4a451aa170d48a7ba76920cef8c92b622822874dc02ea19037168cb7276fc@75.134.144.252:30303
INFO [11-06|05:50:06.414] IPC endpoint opened                      url=/tmp/geth.ipc
INFO [11-06|05:50:06.418] Mapped network port                      proto=udp extport=30303 intport=30303 interface=NAT-PMP(192.168.86.1)
INFO [11-06|05:50:06.423] Mapped network port                      proto=tcp extport=30303 intport=30303 interface=NAT-PMP(192.168.86.1)
WARN [11-06|05:50:06.455] Rewinding blockchain                     target=11000000
INFO [11-06|05:50:16.458] Looking for peers                        peercount=0 tried=44 static=0
INFO [11-06|05:50:26.697] Looking for peers                        peercount=0 tried=52 static=0
INFO [11-06|05:50:36.734] Looking for peers                        peercount=3 tried=45 static=0
INFO [11-06|05:50:42.316] Block synchronisation started
INFO [11-06|05:50:46.754] Looking for peers                        peercount=1 tried=60 static=0
INFO [11-06|05:50:47.094] Disabling direct-ancient mode            origin=11316917 ancient=11316052
WARN [11-06|05:50:48.135] Invalid header encountered               number=11316918 hash="6e4958…466a4e" parent="1bd7a4…ada78b" err="unknown ancestor"
INFO [11-06|05:50:48.135] Imported new state entries               count=5 elapsed="1.523µs" processed=152577627 pending=81 trieretry=0 coderetry=0 duplicate=0 unexpected=0
INFO [11-06|05:50:48.135] Downloader queue stats                   receiptTasks=0 blockTasks=0 itemSize=0.00B throttle=8192
WARN [11-06|05:50:48.135] Synchronisation failed, dropping peer    peer=ae0e7c0bbf2d3ea2 err="retrieved hash chain is invalid: unknown ancestor"
INFO [11-06|05:50:57.130] Looking for peers                        peercount=1 tried=36 static=0
INFO [11-06|05:50:59.195] Disabling direct-ancient mode            origin=11313932 ancient=11313741
INFO [11-06|05:51:05.332] Imported new state entries               count=545 elapsed="1.82µs"  processed=152578172 pending=5780 trieretry=0 coderetry=0 duplicate=0 unexpected=0
INFO [11-06|05:51:07.151] Looking for peers                        peercount=2 tried=55 static=0
INFO [11-06|05:51:10.949] Imported new state entries               count=384 elapsed="1.2µs"   processed=152578556 pending=6325 trieretry=0 coderetry=0 duplicate=0 unexpected=0
INFO [11-06|05:51:15.149] Imported new state entries               count=384 elapsed="1.916µs" processed=152578940 pending=6856 trieretry=0 coderetry=0 duplicate=0 unexpected=0
INFO [11-06|05:51:17.227] Looking for peers                        peercount=2 tried=48 static=0
INFO [11-06|05:51:19.116] Imported new state entries               count=384 elapsed="1.739µs" processed=152579324 pending=7247 trieretry=0 coderetry=0 duplicate=0 unexpected=0
INFO [11-06|05:51:22.740] Imported new state entries               count=384 elapsed="2.428µs" processed=152579708 pending=7640 trieretry=0 coderetry=0 duplicate=0 unexpected=0
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=0x18 pc=0x977726]

goroutine 1774 [running]:
github.com/ethereum/go-ethereum/trie.(*SyncBloom).Add(0x0, 0xc00a794580, 0x20, 0x20)
        github.com/ethereum/go-ethereum/trie/sync_bloom.go:175 +0x26
github.com/ethereum/go-ethereum/trie.(*Sync).Commit(0xc002f5ed00, 0x15e3160, 0xc006c40300, 0x1c99091, 0x1c99091)
        github.com/ethereum/go-ethereum/trie/sync.go:316 +0x1c5
github.com/ethereum/go-ethereum/eth/downloader.(*stateSync).commit(0xc002572c80, 0xc000100801, 0x7ff9d823a748, 0x0)
        github.com/ethereum/go-ethereum/eth/downloader/statesync.go:404 +0x99
github.com/ethereum/go-ethereum/eth/downloader.(*stateSync).loop.func1(0xc002572c80, 0xc0030effb8)
        github.com/ethereum/go-ethereum/eth/downloader/statesync.go:338 +0x30
panic(0x11eec00, 0x1ebd650)
        runtime/panic.go:969 +0x175
github.com/ethereum/go-ethereum/trie.(*SyncBloom).Add(0x0, 0xc00a794540, 0x20, 0x20)
        github.com/ethereum/go-ethereum/trie/sync_bloom.go:175 +0x26
github.com/ethereum/go-ethereum/trie.(*Sync).Commit(0xc002f5ed00, 0x15e3160, 0xc006c402e0, 0xc001380b5c, 0x14850b0)
        github.com/ethereum/go-ethereum/trie/sync.go:316 +0x1c5
github.com/ethereum/go-ethereum/eth/downloader.(*stateSync).commit(0xc002572c80, 0x100, 0xbfe16c0f04789868, 0x2024eee114)
        github.com/ethereum/go-ethereum/eth/downloader/statesync.go:404 +0x99
github.com/ethereum/go-ethereum/eth/downloader.(*stateSync).loop(0xc002572c80, 0x0, 0x0)
        github.com/ethereum/go-ethereum/eth/downloader/statesync.go:346 +0x16b
github.com/ethereum/go-ethereum/eth/downloader.(*stateSync).run(0xc002572c80)
        github.com/ethereum/go-ethereum/eth/downloader/statesync.go:309 +0x2b
created by github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).runStateSync
        github.com/ethereum/go-ethereum/eth/downloader/statesync.go:106 +0x1c5

Backtrace

[backtrace]

meowsbits avatar Nov 06 '20 12:11 meowsbits