nasa / SBN

38 stars 23 forks source link

CFE_SB_GetLastSenderId() broken -- could result in lost messages or echoes #30

Closed CDKnightNASA closed 4 years ago

CDKnightNASA commented 4 years ago

When discussed at the cFS CCB yesterday, I realized that the CFE_SB_GetLastSenderId() function, as used by SBN, is not correct. The problem is that SBN needs a way to determine whether a message it is reading off the bus is a message that SBN just published to that bus. SBN checks the last sender and ignores the message when the last sender is SBN. This is fine in the case where SBN is reading the last message on the bus, but if there are multiple messages on the bus, the GetLastSenderId() returns the last sender, not the sender of the message currently being read.

For example, if the the pipe had: 1 SCH wakeup 2 SBN CI msg from peer 3 LC result

When SBN reads the pipe, it reads msg 1 and sees that the sender is LC It reads messages 2 and sees that the sender is LC. Only when it reads 3 does it have the right sender.

The CFE_SB_RcvMsg API is being enhanced to address this and GetLastSenderId() being removed. Using either task-based reading of the pipes (which wakes up as soon as a message is published on that pipe, ensuring only one message on the pipe) or using a high read frequency will help reduce the likelihood of a problem.

Soon, I'll be committing a change that uses a new RcvMsg API that will be available in a pull request.

CDKnightNASA commented 4 years ago

see https://github.com/nasa/cFE/issues/759

CDKnightNASA commented 4 years ago

fixed in https://github.com/nasa/SBN/commit/330eba0b206d9778ad326a6436529e7575e4ff40