Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

patches bug in recv_mmsg when npkts != nrecv#22276

Merged
behzadnouri merged 2 commits intosolana-labs:masterfrom
behzadnouri:recv-mmsg-npkt-patch
Jan 4, 2022
Merged

patches bug in recv_mmsg when npkts != nrecv#22276
behzadnouri merged 2 commits intosolana-labs:masterfrom
behzadnouri:recv-mmsg-npkt-patch

Conversation

@behzadnouri
Copy link
Copy Markdown
Contributor

Problem

If recv_mmsg receives 2 packets where the first one is filtered out,
then it returns npkts == 1:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/recvmmsg.rs#L104-L115

But then streamer::packet::recv_from will erroneously keep the 1st
packet and drop the 2nd one:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/packet.rs#L34-L49

Summary of Changes

To avoid this bug, this commit updates recv_mmsg to always return total
number of received packets. If socket address cannot be correctly
obtained, it is left as the default value which is UNSPECIFIED:
https://github.com/solana-labs/solana/blob/01a096adc/sdk/src/packet.rs#L145

Also removing total_size from return value since it is unused.

Comment thread streamer/src/recvmmsg.rs Outdated
If recv_mmsg receives 2 packets where the first one is filtered out,
then it returns npkts == 1:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/recvmmsg.rs#L104-L115

But then streamer::packet::recv_from will erroneously keep the 1st
packet and drop the 2nd one:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/packet.rs#L34-L49

To avoid this bug, this commit updates recv_mmsg to always return total
number of received packets. If socket address cannot be correctly
obtained, it is left as the default value which is UNSPECIFIED:
https://github.com/solana-labs/solana/blob/01a096adc/sdk/src/packet.rs#L145
Copy link
Copy Markdown
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

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

Looks good to me! Given that this one blows away #22245, I don't see any need to backport 22245 to 1.9

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 4, 2022

Codecov Report

Merging #22276 (79c59b9) into master (6c65734) will increase coverage by 0.0%.
The diff coverage is 100.0%.

@@           Coverage Diff           @@
##           master   #22276   +/-   ##
=======================================
  Coverage    81.1%    81.1%           
=======================================
  Files         523      523           
  Lines      146793   146791    -2     
=======================================
+ Hits       119067   119104   +37     
+ Misses      27726    27687   -39     

@behzadnouri behzadnouri merged commit 379feec into solana-labs:master Jan 4, 2022
@behzadnouri behzadnouri deleted the recv-mmsg-npkt-patch branch January 4, 2022 21:07
mergify Bot added a commit that referenced this pull request Jan 4, 2022
* removes total-size from return value of recv_mmsg

(cherry picked from commit 4b24499)

* patches bug in recv_mmsg when npkts != nrecv

If recv_mmsg receives 2 packets where the first one is filtered out,
then it returns npkts == 1:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/recvmmsg.rs#L104-L115

But then streamer::packet::recv_from will erroneously keep the 1st
packet and drop the 2nd one:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/packet.rs#L34-L49

To avoid this bug, this commit updates recv_mmsg to always return total
number of received packets. If socket address cannot be correctly
obtained, it is left as the default value which is UNSPECIFIED:
https://github.com/solana-labs/solana/blob/01a096adc/sdk/src/packet.rs#L145

(cherry picked from commit 379feec)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
@brooksprumo brooksprumo mentioned this pull request Jan 5, 2022
mergify Bot added a commit that referenced this pull request Feb 6, 2022
* removes total-size from return value of recv_mmsg

(cherry picked from commit 4b24499)

* patches bug in recv_mmsg when npkts != nrecv

If recv_mmsg receives 2 packets where the first one is filtered out,
then it returns npkts == 1:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/recvmmsg.rs#L104-L115

But then streamer::packet::recv_from will erroneously keep the 1st
packet and drop the 2nd one:
https://github.com/solana-labs/solana/blob/01a096adc/streamer/src/packet.rs#L34-L49

To avoid this bug, this commit updates recv_mmsg to always return total
number of received packets. If socket address cannot be correctly
obtained, it is left as the default value which is UNSPECIFIED:
https://github.com/solana-labs/solana/blob/01a096adc/sdk/src/packet.rs#L145

(cherry picked from commit 379feec)

# Conflicts:
#	streamer/src/recvmmsg.rs

* removes mergify merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants