-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Describe the bug
SB has some code to filter an app's own messages via CFE_SB_PIPEOPTS_IGNOREMINE. This gets the appid and compares to the AppID of the pipe creator, and skips the destination if its a match:
cFE/fsw/cfe-core/src/sb/cfe_sb_api.c
Lines 1359 to 1369 in 8a7dc8f
| if(PipeDscPtr->Opts & CFE_SB_PIPEOPTS_IGNOREMINE) | |
| { | |
| CFE_ES_ResourceID_t AppId; | |
| CFE_ES_GetAppID(&AppId); | |
| if( CFE_ES_ResourceID_Equal(PipeDscPtr->AppId, AppId) ) | |
| { | |
| continue; | |
| } | |
| }/* end if */ |
The problem is that this is "inside the loop" of all destinations in the routing entry. So it will (potentially) call CFE_ES_GetAppId() multiple times. This also creates a double locking situation, because the SB lock is being held at the time this executes, and the ES lock needs to be acquired by CFE_ES_GetAppId()
Expected behavior
Code should query the caller AppID early, before taking the SB lock.
Additional context
The code works but is inefficient, and double locking is a potential deadlock.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.