Skip to content

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

Merged
merged 1 commit into from
Mar 6, 2018

Conversation

cmonr
Copy link
Contributor

@cmonr cmonr commented Feb 22, 2018

Description

Modifies the underflow error in RTX to be reported as an overflow error, for user clarity.

Pull request type

  • Fix
  • Refactor
  • New Target
  • Feature

@@ -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",
Copy link
Contributor

@0xc0170 0xc0170 Feb 23, 2018

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

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor

@geky geky Feb 23, 2018

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

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

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!

@cmonr
Copy link
Contributor Author

cmonr commented Feb 27, 2018

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?

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 27, 2018

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 ).

@cmonr cmonr force-pushed the fix-underflow-error-msg branch from 92d9b7f to f70ab45 Compare March 5, 2018 19:29
End users are more familiar with handling overflow errors, even if underflow may be technically correct
@cmonr cmonr force-pushed the fix-underflow-error-msg branch from 9d0ea51 to 05dd446 Compare March 5, 2018 19:39
@cmonr
Copy link
Contributor Author

cmonr commented Mar 5, 2018

Squashed commits, and added comment to commit and c code as to why the text was changed.

@0xc0170 @bulislaw @geky @neil-tan Thoughts? Good to go?

Copy link
Contributor

@geky geky left a 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

@cmonr
Copy link
Contributor Author

cmonr commented Mar 5, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 5, 2018

Build : SUCCESS

Build number : 1344
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6173/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@kegilbert
Copy link
Contributor

Awesome, thanks for this!

@mbed-ci
Copy link

mbed-ci commented Mar 5, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 6, 2018

@cmonr
Copy link
Contributor Author

cmonr commented Mar 6, 2018

ಠ_ಠ

/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 6, 2018

Test : SUCCESS

Build number : 1131
Test logs :http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/6173/1131

@cmonr cmonr merged commit 31ccedc into ARMmbed:master Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants