-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Got Exception 28 when lost internet and reconnect internet using MQTT #4134
Comments
I use git version, with latest commit with v2 MSS=536
with v2 MSS=1460
|
I just updated an hour ago and this is happening to me as well. In my case, I load client certificates for mutual authentication to aws iot.
|
There is an option in the Arduino menu to enable debug oom. Please enable, rebuild, and retest. I'd like to know if there is an oom message in the log just before the crash. |
I was able to resolve the Exception 28 in the case of WifiClientSecure. It appears to be due to a recent refactor where the client context lost initialization to nullptr. Created a PR for it #4149. I don't believe it's related to this specific issue as my issue is not with the async library. |
thank @ztittle,
|
I have been tested with LwIP v1.4 (prebuild) and it works perfectly. |
edit: not yet in master, check #4078 A fix for WiFi dis/reconnection is now in master (not really about "lost internet"). @tarzan115 @ztittle Can you please retry with current git master with debug options enabled (serial debug output and CORE+WIFI+...+OOM) ? If the problem persist, it will help a lot for us to have a sketch so we can locally reproduce the issue and try to fix it. |
my issue still valid with this log. option is
decode stack
and sometime got this
|
I use libraries async-mqtt-client and ESPAsyncTCP with config
|
Looks like you are running out of memory as per the @igrr this line seems to return NULL. @devyte suggested that More generally, would we have new functions like
I would be please to provide such a PR for the core. @earlephilhower what do you think ? |
AxTLS is pretty lax in checking for null pointers (it mostly doesn't have any checks). Making allocs in axTLS to cause panic on failure would be an improvement, but only a cosmetic one — that doesn't help to get the problem fixed. I don't like the idea of panicking on failed standard malloc. There are a few places where malloc failure is checked and handled in a reasonable way (e.g. in LwIP). Another option (more general one) is to print some heap info in the panic handler. E.g. "last allocation has failed" kind of thing. By the way, there is an open issue about axTLS crashing on oom. Suggest merging this one with that issue. I'm on mobile so can't find it right now... |
My own opinion is that I'm a bit leery of changing the behavior of such a basic operation. Malloc() can always return failure. If the app coder doesn't check for it. that's their own fault. May apps can handle a NULL return, but I'd bet that almost none of them would ever implement a mallloc_check(), just for the ESP8266 Arduino. So, I'd thumbs down changing malloc() to SEGV. UMM spews :oom errors when that flag's enabled, right? Do we dump stack (but continue) at that point so at some later point when a real SEGV happens because of the NULL pointer? W/o call stack, the fact that a malloc failed isn't so useful for debugging where it happened. Just thinking out loud, maybe somewhere between @igrr and @d-a-v, we can stash the app-level malloc() caller address when a malloc fails, and then dump that on a panic. That way your well-behaved app will still work fine when it gets a NULL, but a bad app will crash and have the last failed malloc() ID'd for examination? No need to spew :oom in that case. |
@earlephilhower :oom does not dump nor save stack when triggered but shows caller's FILE/LINE.
|
So even the memory manager itself sometimes doesn't check for null on malloc. 😞
|
This merits a local fix, and opening an issue in the umm repo. |
Assuming this is thr right source repo, it's already fixed there:
I'll open a bug and a patch in the ESP8266 repo. |
my issue is gone. Thanks, guys! |
@earlephilhower This is the right author but his code was not on github when @igrr started to use it. |
@d-a-v I see you've pulled in the realloc() free()ing on OOM fix. The rest of his changes seems to be an optimization of the realloc algorithm, but it's only been in his codebase a couple weeks. Is that the bit you're talking about? Rest of the code seems untouched in that branch. Any particular case you're trying to fix/optimize, that can be tested against his changes? W/o a compelling reason, IMO it's a bit premature to pull in such fresh code in a bit of the core that's so important. |
Hi folks, I am the author of umm_malloc() and would like to make sure that this library meets your exact needs. The specific case that that branch (issue-11) was trying to fix was that a failled re-allocation did not leave the original memory intact. |
Hi @rhempel , your support is greatly appreciated! We're currently in a sort of code freeze waiting for the imminent sdk 2.2 release, so that we can make our own much needed 2.4.1 release. Investigation of issue-11 is tracked in #4047 , and I certainly expect to look at it in detail myself, once 2.4.1 is out the door. |
Basic Infos
Hardware
Hardware:
ESP-12E
Core Version:
2.4.0
Description
I used library async mqtt to connect mqtt, but when I already connected to the broker. I plug out the line of the internet, wifi still present. after 1 minute I plug in to have internet. and my device auto reconnect to broker and crash with
Exception 28
Settings in IDE
Module:
Generic ESP8266 Module
Flash Size:
4MB/3MB
CPU Frequency:
80Mhz
Flash Mode:
dio
Flash Frequency:
40Mhz
Upload Using:
SERIAL
Reset Method:
ck
LwIP Variant: both
v2 Prebuild (MSS=536)
andv2 Prebuild (MSS=1460 , unstable)
got that errorSketch
Debug Messages
The text was updated successfully, but these errors were encountered: