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

OS_TaskPrepare should propagate return code. #565

Closed
jphickey opened this issue Aug 18, 2020 · 0 comments · Fixed by #566 or #576
Closed

OS_TaskPrepare should propagate return code. #565

jphickey opened this issue Aug 18, 2020 · 0 comments · Fixed by #566 or #576
Assignees
Labels
Milestone

Comments

@jphickey
Copy link
Contributor

Describe the bug
In the internal OS_TaskPrepare() routine, it calls a low-level implementation routine but does not propagate the return code.

To Reproduce
More theoretical than real. In POSIX this depends on the underlying pthread_setspecific() routine returning an error, of which the only documented error (at least per POSIX) is ENOMEM. However that doesn't mean that there couldn't be other implementation-specific errors on other systems.

Expected behavior
If the OS_TaskRegister_Impl() fails, this result should be propagated up the stack and prevent the task from starting.

Code snips
See here:

if (return_code == OS_SUCCESS)
{
OS_TaskRegister_Impl(task_id);
}
else
{
*entrypt = NULL;
}

System observed on:

Additional context
If this fails then it means dependent routines like OS_TaskGetId() will also be broken, so it really should block startup of the task and return the error to the caller. Catching this type of error early, when possible, is usually better than getting an obfuscated error later.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Aug 18, 2020
@jphickey jphickey added the bug label Aug 18, 2020
jphickey added a commit to jphickey/osal that referenced this issue Aug 18, 2020
If this routine fails then return the error to the caller,
which will also prevent the task from starting.
yammajamma added a commit that referenced this issue Aug 20, 2020
Fix #565, propagate return code from OS_TaskRegister_Impl()
@astrogeco astrogeco added this to the 6.0.0 milestone Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants