-
Notifications
You must be signed in to change notification settings - Fork 13.3k
panic() called from ISR causes Hardware WDT #6283
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
Comments
After a quick look it looks like Arduino/cores/esp8266/core_esp8266_postmortem.cpp Lines 224 to 226 in 8c37601
|
Replacing Never dug into this code before. (edit0: |
FWIW: This is logic flow that I think I see at For ps.intlevel = 0 in non ISR context:
For ps.intlevel != 0 and from a hardware ISR context:
Assumption: Between ps.intlevel !=0 and hardware interrupt priority soft WDT |
@mhightower83 #6172 is a first fix for this issue. |
@d-a-v Thanks! I think this is going to help out a lot of people. |
Basic Infos
Platform
Settings in IDE
Problem Description
I have found, that there are some actions that an ISR can take, that can unexpectedly result in a "Hardware WDT". Calls made from an ISR to panic(), abort(), assert(), or the __unhandled_exception() will result in: no message, no stack trace, just:
Obviously, it would be best to avoid these in our ISRs. However, it might not be obvious we are doing these calls from an ISR. Take the case of running a build with just "Debug: Serial" selected in the IDE.
This will enable the
UMM_POISON
, build flag. If an ISR steps on the poison, then later does afree()
, a message is printed (with non-IRAM basedprintf()
function) then an attempt is made withinumm_malloc.cpp
to callpanic()
. When I tested this the umm poison message printed; however, thepanic()
details never appeared. Alter a long period, the "Hardware WDT" event appeared.What I think I am seeing is, calls from an ISR that reach a panic(), abort(), assert(), or the __unhandled_exception() will eventually arrive at
raise_exception()
in modulecore_postmortem.cpp
. Then onto the inline assembly for "syscall". After a long period of silence, I see the "Hardware WDT" event. My test method at that time was less than ideal because I was using a printf function that was not in IRAM. However, it did print all the way up to the "syscall", before the WDT appeared and nothing at __wrap_system_restart_local().It is interesting to find that there are causes for the "Hardware WDT", that are not caused by being stuck in a loop.
In Arduino Core 2.5.0 and up, a failed "new" operator without
(std::nothrow)
in an ISR will callabort()
resulting in WDT. I am concerned that there might be a lot more cases out there.This one is unconfirmed however looks like a good one to verify:
Arduino/cores/esp8266/core_esp8266_main.cpp
Lines 104 to 115 in 7c67015
Arduino/cores/esp8266/cont_util.cpp
Lines 65 to 68 in 7c67015
It looks like a call from an ISR, that reaches yield(), would call panic() and the message would never be seen.
I could say more but I'll wait and see what you say, just in case I made a wrong turn in my assessment of this issue.
MCVE Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: