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 Jan 4, 2022
Merged
patches bug in recv_mmsg when npkts != nrecv#22276behzadnouri merged 2 commits intosolana-labs:masterfrom
behzadnouri merged 2 commits intosolana-labs:masterfrom
Conversation
t-nelson
reviewed
Jan 4, 2022
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
8af981b to
79c59b9
Compare
t-nelson
approved these changes
Jan 4, 2022
Codecov Report
@@ Coverage Diff @@
## master #22276 +/- ##
=======================================
Coverage 81.1% 81.1%
=======================================
Files 523 523
Lines 146793 146791 -2
=======================================
+ Hits 119067 119104 +37
+ Misses 27726 27687 -39 |
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>
Closed
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
If
recv_mmsgreceives 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_fromwill erroneously keep the 1stpacket 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_mmsgto always return totalnumber 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_sizefrom return value since it is unused.