-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Exception 0 in LWIP2 on DHCP renew with WIFI_OFF #5667
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
Please note: this application periodically turns the wifi modem off for several minutes and then on again for several minutes; it uses the WiFi.mode() method to do so:
|
This is unclear to me yet. From 2.4.2:
This function I'll try to |
Thank you @d-a-v ! Overnight, the code took another exception along the same code path but at a different place (still in the system context). Do you know where the size of the system stack is defined? Also, do you know if we're supposed to stop the DHCP client before turning off WiFi since it looks like DHCP continues to fire timeouts when WiFi is disabled? Exception (0): ctx: sys
|
@dalbert2 could you please try to recreate the issue with an MCVE sketch? something like periodically turning the wifi on-off , and if that doesn't reproduce try adding elements from your app one by one. |
Stopping DHCPC before turning off WiFi and starting it again after WiFi is turned back on makes the problem go away. |
@dalbert2 Thanks alot! We will fix before 2.5.0 happens |
Thanks @d-a-v ! The fix looks (obviously) like this: |
Basic Infos
Platform
Settings in IDE
Problem Description
Exception 0: interaction between application context printf and interrupt context printf
Detailed problem description goes here.
I'm experiencing periodic Exception 0s and the stack trace shows it is happening during vsnprintf in the LWIP stack when it's handling a DHCP timeout/renew (probably when WiFi is off). The exception address is always part of a printf format string from the application context. The particular address/string isn't the same in each exception, but the stack trace always ends at _vsnprintf_r and the exception address is always part of an application Serial.printf_P format string. In the example provided below, the exception address is 0x2C75253D which is ASCII "=%u," which only exists at one place in the code (see instruction below).
I first guessed that this might be a case of the app context stack overflowing into the ISR stack and tried increasing CONT_STACKSIZE to 6K but the exception still takes place. Moreover, the stack dump isn't anywhere near 4K (it's 768 bytes deep in the stack dump below)...so it must be something else (how big is the interrupt stack?)
All of the application code is running in the application context (no application ISRs). Any ideas would be much appreciated.
MCVE Sketch
Serial.printf_P(PSTR("TIMESLOT: %u (ts=%u, nbr=%u, ch=%u, mode=%u)"), time, slot, neighbors[slot].id, new_channel, mode);
Debug Messages
The text was updated successfully, but these errors were encountered: