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

BenchmarkInsertChain_uncles panics #24654

Closed
meowsbits opened this issue Apr 6, 2022 · 1 comment · Fixed by #24657
Closed

BenchmarkInsertChain_uncles panics #24654

meowsbits opened this issue Apr 6, 2022 · 1 comment · Fixed by #24657
Labels

Comments

@meowsbits
Copy link
Contributor

System information

> git rev-parse HEAD && go version && uname -a
111a1b73cfe87782ed34659f704bbea70b032e1e
go version go1.17.8 linux/amd64
Linux ubp52 5.2.9-050209-generic #201908160940 SMP Fri Aug 16 09:42:58 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

(111a1b7, current master head at time of writing)

Expected behaviour

Tests run and pass.

Actual behaviour

Tests panic at BenchmarkInsertChain_uncles_diskdb and BenchmarkInsertChain_uncles_memdb.
The parent variable value is nil in AddUncles in chain_makers.go.

Steps to reproduce the behaviour

go test -bench uncles ./core

Backtrace

[...]
BenchmarkInsertChain_uncles_memdb-12            t=2022-04-06T09:05:37-0700 lvl=info msg="Persisted trie from memory database"    nodes=1 size="165.00 B" time="4.53µs"   gcnodes=0 gcsize="0.00 B"   gctime=0s        livenodes=1  livesize="0.00 B"
t=2022-04-06T09:05:37-0700 lvl=dbug msg="Persisted trie from memory database"    nodes=3 size="425.00 B" time="5.939µs"  gcnodes=0 gcsize="0.00 B"   gctime=0s        livenodes=1  livesize="0.00 B"
t=2022-04-06T09:05:37-0700 lvl=dbug msg="Persisted trie from memory database"    nodes=2 size="261.00 B" time="3.17µs"
  gcnodes=0 gcsize="0.00 B"   gctime=0s        livenodes=1  livesize="0.00 B"
t=2022-04-06T09:05:37-0700 lvl=dbug msg="Persisted trie from memory database"    nodes=2 size="261.00 B" time="2.979µs"  gcnodes=0 gcsize="0.00 B"   gctime=0s        livenodes=1  livesize="0.00 B"
t=2022-04-06T09:05:37-0700 lvl=dbug msg="Persisted trie from memory database"    nodes=2 size="261.00 B" time="3.222µs"  gcnodes=0 gcsize="0.00 B"   gctime=0s        livenodes=1  livesize="0.00 B"
t=2022-04-06T09:05:37-0700 lvl=dbug msg="Persisted trie from memory database"    nodes=2 size="261.00 B" time="2.846µs"  gcnodes=0 gcsize="0.00 B"   gctime=0s        livenodes=1  livesize="0.00 B"
t=2022-04-06T09:05:37-0700 lvl=dbug msg="Persisted trie from memory database"    nodes=2 size="261.00 B" time="4.833µs"  gcnodes=0 gcsize="0.00 B"   gctime=0s        livenodes=1  livesize="0.00 B"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1c0 pc=0x7fcda2]

goroutine 98547 [running]:
github.com/ethereum/go-ethereum/consensus/ethash.CalcDifficulty(0x1039d40, 0x40fd07, 0x0)
        /home/ia/go/src/github.com/ethereum/go-ethereum/consensus/ethash/consensus.go:335 +0x42
github.com/ethereum/go-ethereum/consensus/ethash.(*Ethash).CalcDifficulty(0x77a36453b9905655, {0xae0288, 0xc008e50338}, 0x708be1f3980c4227, 0xc0373bd0e0)
        /home/ia/go/src/github.com/ethereum/go-ethereum/consensus/ethash/consensus.go:328 +0x45
github.com/ethereum/go-ethereum/core.(*BlockGen).AddUncle(0xc0441866e0, 0xc008ced200)
        /home/ia/go/src/github.com/ethereum/go-ethereum/core/chain_makers.go:169 +0x14e
github.com/ethereum/go-ethereum/core.genUncles(0xae3b80, 0xc008e500d0)
        /home/ia/go/src/github.com/ethereum/go-ethereum/core/bench_test.go:168 +0xaf
github.com/ethereum/go-ethereum/core.GenerateChain.func1(0x6, 0xc025d7bb00, 0xc0101e6d00)
        /home/ia/go/src/github.com/ethereum/go-ethereum/core/chain_makers.go:256 +0x486
github.com/ethereum/go-ethereum/core.GenerateChain(0xc0039fe300, 0xc025d7b680, {0xae8318, 0xc0102ce0e0}, {0xaee4c8, 0xc005fc2000}, 0x64, 0xa32870)
        /home/ia/go/src/github.com/ethereum/go-ethereum/core/chain_makers.go:279 +0x22d
github.com/ethereum/go-ethereum/core.benchInsertChain(0xc008c6c000, 0x79, 0x1071920)
        /home/ia/go/src/github.com/ethereum/go-ethereum/core/bench_test.go:200 +0x4fa
github.com/ethereum/go-ethereum/core.BenchmarkInsertChain_uncles_memdb(0xc008c6c000)
        /home/ia/go/src/github.com/ethereum/go-ethereum/core/bench_test.go:56 +0x25
testing.(*B).runN(0xc008c6c000, 0x64)
        /home/ia/go1.17.8.linux-amd64/src/testing/benchmark.go:192 +0x126
testing.(*B).launch(0xc008c6c000)
        /home/ia/go1.17.8.linux-amd64/src/testing/benchmark.go:328 +0x1c5
created by testing.(*B).doBench
        /home/ia/go1.17.8.linux-amd64/src/testing/benchmark.go:283 +0x7b
exit status 2
FAIL    github.com/ethereum/go-ethereum/core    54.426s
FAIL

When submitting logs: please submit them as text and not screenshots.

@rjl493456442
Copy link
Member

Thanks for catching it, the fix is opened.

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

Successfully merging a pull request may close this issue.

2 participants