Fix race condition in stream buffers when priority(IP task)==priority(task using TCP/IP)#517
Merged
AniruddhaKanhere merged 18 commits intoFreeRTOS:mainfrom Jul 7, 2022
Merged
Conversation
Member
Author
|
/bot run uncrustify |
aggarg
approved these changes
Jul 7, 2022
htibosch
approved these changes
Jul 7, 2022
Contributor
htibosch
left a comment
There was a problem hiding this comment.
@AniruddhaKanhere wrote:
... when the task in question is using both send and recv functions
A small correction: there was a race condition between the IP-task and the task that calls recv().
The transmission stream works independently.
And maybe it is also worth telling that the problem was reported by Shayan Mukhtar in this post on the FreeRTOS forum.
To summarise the problem once more: the members uxHead and uxFront must be updated together, in a single atomic operation. Suspend/resume will be called from the IP-task only.
The solution was tested and I approve it.
Thank you
Member
Author
|
@htibosch, I updated my description. Thanks for pointing that out. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
When the priority of the TCP/IP stack and the priority of the task using TCP/IP stack are equal AND when the task in question is using the
recvfunction, then there is a possible race condition that exists in the stream buffers which lead to advertisement of 0 window.This PR fixes that by adding a critical section around the stream buffer member update section.
Test Steps
Related Issue
This problem was reported by Shayan Mukhtar in this post on the FreeRTOS forum.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.