Skip to content

mempool: fix nil pointer dereference#5412

Merged
melekes merged 5 commits intomasterfrom
anton/5408
Sep 29, 2020
Merged

mempool: fix nil pointer dereference#5412
melekes merged 5 commits intomasterfrom
anton/5408

Conversation

@melekes
Copy link
Contributor

@melekes melekes commented Sep 28, 2020

previously, the second next could return nil, which would be the reason
for panic on line 275:

memTx := next.Value.(*mempoolTx)

Closes #5408

previously, the second next could return nil, which would be the reason
for panic on line 275:

memTx := next.Value.(*mempoolTx)

Closes #5408
@melekes melekes changed the title fix nil pointer dereference mempool: fix nil pointer dereference Sep 28, 2020
@melekes melekes self-assigned this Sep 28, 2020
@codecov
Copy link

codecov bot commented Sep 28, 2020

Codecov Report

Merging #5412 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #5412      +/-   ##
==========================================
+ Coverage   61.24%   61.28%   +0.04%     
==========================================
  Files         259      259              
  Lines       23437    23438       +1     
==========================================
+ Hits        14354    14364      +10     
+ Misses       7625     7619       -6     
+ Partials     1458     1455       -3     
Impacted Files Coverage Δ
mempool/reactor.go 84.84% <100.00%> (+2.40%) ⬆️
privval/signer_listener_endpoint.go 81.25% <0.00%> (-7.50%) ⬇️
blockchain/v2/routine.go 74.54% <0.00%> (-3.64%) ⬇️
blockchain/v0/reactor.go 60.59% <0.00%> (-0.99%) ⬇️
blockchain/v0/pool.go 76.01% <0.00%> (-0.74%) ⬇️
proxy/multi_app_conn.go 48.64% <0.00%> (ø)
privval/signer_endpoint.go 78.78% <0.00%> (ø)
consensus/state.go 68.13% <0.00%> (+0.09%) ⬆️
consensus/reactor.go 74.08% <0.00%> (+0.25%) ⬆️
mempool/clist_mempool.go 84.01% <0.00%> (+1.48%) ⬆️
... and 4 more

Copy link
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Have we verified that there aren't any other races here?

@melekes

This comment has been minimized.

// regression test for https://github.com/tendermint/tendermint/issues/5408
func TestReactorConcurrency(t *testing.T) {
config := cfg.TestConfig()
const N = 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this actually do? Seems like we're only testing two reactors regardless of this setting, in which case I think we can just drop this constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use it when creating reactors makeAndConnectReactors. the number can be increased to 4 for example. 2 is only required when we want to assert the order of transactions on the receiving side

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but what purpose would it serve to start more reactors than the two we're testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of any

@melekes melekes merged commit 99aea7b into master Sep 29, 2020
@melekes melekes deleted the anton/5408 branch September 29, 2020 08:15
melekes added a commit that referenced this pull request Sep 30, 2020
previously, the second next could return nil, which would be the reason
for panic on line 275:

memTx := next.Value.(*mempoolTx)

Closes #5408
boxi11 added a commit to boxi11/tendermint that referenced this pull request Sep 30, 2020
* mempool: fix nil pointer dereference (tendermint#5412)

previously, the second next could return nil, which would be the reason
for panic on line 275:

memTx := next.Value.(*mempoolTx)

Closes tendermint#5408

* docs: specify TM version in go tutorials (tendermint#5427)

Closes tendermint#5425

* privval: allow passing options to NewSignerDialerEndpoint (tendermint#5434)

Required for tendermint#5291 to set timeouts for remote signers.

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
Co-authored-by: Erik Grinaker <erik@interchain.berlin>
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked

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

Successfully merging this pull request may close these issues.

Nil pointer dereference in the mempool reactor

3 participants