Race Condition in xStreamBufferReceive? FreeRTOS V10.2.1

I’ve have a single task that is blocking on xStreamBufferReceive for 10ms (xBlockTime = pdMS_TO_TICKS( 10 )).

receivedBytes = xStreamBufferReceive( _streamBufferHandle, ( void * ) ucRxData, ucRxDataSize, xBlockTime );

The task is being fed by an serial port interrupt that is sending UART data ins a stream via xStreamBufferSendFromISR.

xBytesSent = xStreamBufferSendFromISR( xStreamBufferUsart2, data, len, &xHigherPriorityTaskWoken);

This has been working for years, but recently we have been trying to push as much data as possible through this port. When we started doing this the task that has the xStreamBufferReceive works for a few seconds then becomes permanently blocked. I’ve narrowed it down to a call to xStreamBufferReceive that never returns from the 10ms block. The stream buffer is 8K and once the task blocks I can see the 8K buffer fill up over about a 4 second period before calls to xStreamBufferSendFromISR start failing due to the buffer being full. This seem like it is related to this issue (although the author claims that it should not happen from xStreamBufferSendFromISR):

At this point I kind feel like I’m on my own here and will need to run down the issue in FreeRTOS but I at least wanted to post my findings in case anyone has suggestions as to where to look or as a warning to others that may be seeing similar issues.

As in the GitHub issue we are using V10.2.1 as packaged with STM32 Cube MX.


It looks like there was a long discussion on this before. I’m not in a position to digest it right now (on my cell phone), but have you confirmed you get the same behavior with the latest kernel version?

I think I have been confusing myself, my bit I was looking at to determine where the task last hit was inverted in my head and I am pretty sure that my task is still running but blocking in a different place for a different reason not related to FreeRTOS. If this turns out to be a non-issue I will update this thread.

Yeah, I was fooling myself, nothing to see here. Move along.


Thanks for taking the time to report back.