-
Notifications
You must be signed in to change notification settings - Fork 3k
Modifies error text reported from RTX from 'underflow' to 'overflow' #6173
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
Conversation
@@ -45,7 +45,7 @@ __NO_RETURN uint32_t osRtxErrorNotify (uint32_t code, void *object_id) | |||
switch (code) { | |||
case osRtxErrorStackUnderflow: | |||
// Stack underflow detected for thread (thread_id=object_id) | |||
error("CMSIS-RTOS error: Stack underflow (status: 0x%X, task ID: 0x%X, task name: %s)\n\r", | |||
error("CMSIS-RTOS error: Stack overflow (status: 0x%X, task ID: 0x%X, task name: %s)\n\r", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the name from RTX wrong or just something related to a user clarity? If I read the code here - underflow case, the comment also states underflow, then overflow in error msg. This would make me think it's typo here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, all references are for an underflow error. As best that I can tell though, this error is invoked when stack space is exhausted. I think the reason it's referred to an underflow error is because the direction the stack grows is descending.
From a user's perspective, they know what an overflow error is, but the same can't be said for an underflow (which would be a different error anyways).
@neil-tan could likely give more info since this PR was initially created for him.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cmonr is correct from my knowledge, the underflow error in RTX is actually an overflow and the misnaming has been a pain for a while...Can we change the define to overflow or is that something out of our reach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, I've seen a lot of new users confused about this. They usually think the rtos itself is broken or they didn't configure the thread correctly. Once told it's a stack overflow, things click and they usually move to a completely different stage of debugging.
@kegilbert, no, changing the define breaks compatibility with RTX. See the conversation in #5966.
I'm just going to leave these here:
https://os.mbed.com/questions/79344/Thread-stack-underflow-i-have-no-clue/
http://www.keil.com/forum/22972/stack-underflow/
https://groups.google.com/forum/#!topic/nanopb/-pEAygzmgp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured as much. Maybe a comment saying as much would be nice to point out that the print statement isn't a typo would help future confusion at least a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I know understand it better , thanks for the pointers!
Anyone opposed to seeing this move to the next stage of the PR, or is the consensus that it should get a comment akin to @kegilbert's suggestion? |
That comment there would be good (state it also in the commit msg the intention is there, even those pointers above ppl shared, feel free to reference there in the commit message ). |
92d9b7f
to
f70ab45
Compare
End users are more familiar with handling overflow errors, even if underflow may be technically correct
9d0ea51
to
05dd446
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
/morph build |
Build : SUCCESSBuild number : 1344 Triggering tests/morph test |
Awesome, thanks for this! |
Exporter Build : SUCCESSBuild number : 1000 |
ಠ_ಠ /morph test |
Description
Modifies the underflow error in RTX to be reported as an overflow error, for user clarity.
Pull request type