Skip to content

Race condition in gossipVotesRoutine #1322

@sergio-mena

Description

@sergio-mena

Bug Report

Setup

CometBFT version (use cometbft version or git rev-parse --verify HEAD if installed from source):
main, v0.38.x

Have you tried the latest version: yes/no
yes

ABCI app (name for built-in, URL for self-written if it's publicly available):
N/A

Environment:
N/A

node command runtime flags:
N/A

Config

N/A

What happened?

Crash when running certain e2e tests (networks/nightly/gen-group04-0002.toml).

What did you expect to happen?

No crash

How to reproduce it

Run e2e tests with generated manifest networks/nightly/gen-group04-0002.toml. The test gets stuck at some point. Show the containers' logs and you will see the crash.

Logs

I[2023-09-08|18:07:55.144] received complete proposal block             module=consensus height=1054 hash=8102E33571795EF3C6C245CDD0410A958662E353DDE695B42A219C65D8238F3A
I[2023-09-08|18:07:55.396] finalizing commit of block                   module=consensus height=1054 hash=8102E33571795EF3C6C245CDD0410A958662E353DDE695B42A219C65D8238F3A root=3E624EC55BD219957000C41AC3BFE4945A3220F2045C59F39FED23BA61AECCCB num_txs=4
I[2023-09-08|18:07:55.410] finalized block                              module=state height=1054 num_txs_res=4 num_val_updates=0 block_app_hash=A725F584B9F445F821BBDC6790ADA88E0C5405EC753E94CEAA8DA5B201384C14
I[2023-09-08|18:07:55.410] executed block                               module=state height=1054 app_hash=A725F584B9F445F821BBDC6790ADA88E0C5405EC753E94CEAA8DA5B201384C14
I[2023-09-08|18:07:55.423] committed state                              module=state height=1054 block_app_hash=3E624EC55BD219957000C41AC3BFE4945A3220F2045C59F39FED23BA61AECCCB
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11c6664]

goroutine 1105 [running]:
github.com/cometbft/cometbft/types.(*Commit).WrappedExtendedCommit(...)
	github.com/cometbft/cometbft/types/block.go:947
github.com/cometbft/cometbft/consensus.(*Reactor).gossipVotesRoutine(0xc0002722d0, {0x185b038?, 0xc002618c30}, 0xffff9e20cc00?)
	github.com/cometbft/cometbft/consensus/reactor.go:756 +0x4f4
created by github.com/cometbft/cometbft/consensus.(*Reactor).AddPeer
	github.com/cometbft/cometbft/consensus/reactor.go:202 +0x244

dump_consensus_state output

N/A

Anything else we need to know

Fix ready for review

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions