Skip to content

Repetitive AppID lookups in CFE_SB_SendMsgFull #923

@jphickey

Description

@jphickey

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions