Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop if initialization fails for any reason #80

Closed
jphickey opened this issue May 24, 2021 · 0 comments · Fixed by #81 or #82
Closed

Infinite loop if initialization fails for any reason #80

jphickey opened this issue May 24, 2021 · 0 comments · Fixed by #81 or #82
Assignees
Labels
bug Something isn't working

Comments

@jphickey
Copy link
Contributor

Describe the bug
SCH_LAB does not exit/abort if its initialization fails - it will continue into its main loop anyway. In turn, it is possible that the "CmdPipe" was not initialized when this task calls CFE_SB_ReceiveBuffer. This will return an error, but it just repeats the loop, forever.

To Reproduce
Delete or do not install the SCH LAB table file, so the loading of the table will fail. SCH_LAB then enters an infinite loop, because the CmdPipe is not valid, continually generating this error event:

EVS Port1 42/1/CFE_SB 19: Rcv Err:PipeId 0 does not exist,app SCH_LAB_APP

Expected behavior
If it did not successfully initialize itself, SCH LAB should skip the remainder of its main function, since behavior is non-deterministic if not fully and successfully initialized.

Code snips
The "while" loop here should probably be moved to an "else" block, so it will only be entered if initialized successfully.

if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("SCH_LAB: Error Initializing RC = 0x%08lX\n", (unsigned long)Status);
}
/* Loop Forever */
while (CFE_ES_RunLoop(&RunStatus) == true)

System observed on:
Ubuntu

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/sch_lab that referenced this issue May 24, 2021
Initialize the "RunStatus" to ERROR if initialization fails.
This causes the CFE_ES_RunLoop function to return false, and
the app will exit with an error status.
@jphickey jphickey self-assigned this May 24, 2021
@jphickey jphickey added the bug Something isn't working label May 24, 2021
astrogeco added a commit that referenced this issue Jun 3, 2021
Fix #80, exit the main loop if init fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant