mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #931] Exception 3 WiFiManager::getParamOut() when ConfigPortal started #787
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#787
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dontsovcmc on GitHub (Sep 10, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/931
Basic Infos
I try the last ESP8266 SDK with development branch and it's falls when ConfigPortal started.
How I can debug this problem? It's important to use latest SDK =(. Thanks!
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
don't know
Description
I try development branch with 2.5.2 SDK and it fails. I'm confuzed, cause it works with 2.0.4 version...
2.1.0, 2.2.0 also raise exceptions.
I use ~30 params in config.
Versions
Exception decode
@dontsovcmc commented on GitHub (Sep 10, 2019):
Arrr... The problem in number of Custom Parameters. How I can optimise a memory to increase their number?
Now it's about 28. Exception raised after ~20. It depends of string length.
Why old version of SDK 2.0.4 works?
I print 'page' variable:
@tablatronix commented on GitHub (Sep 10, 2019):
if you set DEBUG_MAX in .h file for debuglevel
uint8_t _debugLevel = DEBUG_MAX;you will get debugging for heap size in logs.
I am guessing you are out of memory, and sdk uses more now ?
@dontsovcmc commented on GitHub (Sep 10, 2019):
@tablatronix commented on GitHub (Sep 10, 2019):
have you tried it with 2.04? to see a difference?
@dontsovcmc commented on GitHub (Sep 10, 2019):
@tablatronix
2.0.4 works.
there is no much difference in memory =(. I try to check heap segmentation.. may be there is another measurements?
@dontsovcmc commented on GitHub (Sep 12, 2019):
@tablatronix look:
platform = platform-espressif8266.git#23542cf - Exception
github.com/platformio/platform-espressif8266@23542cf37egithub.com/platformio/platform-espressif8266@ec1a8a1a87update Arduino core from 2.20500.0 to 2.20501.0github.com/platformio/platform-espressif8266@a66257dcaaplatform = platform-espressif8266.git#32f0b31 - GOOD
there are a lot of difference in building...
as we don't have tiny diff, maybe there are any diagnostic tools? =(
@tablatronix commented on GitHub (Sep 12, 2019):
lots of changes there.
So you say it works on 2.5.0?
Are you using spiffs ? there seems to have been some major changes to that.
You can decode the exceptions of course, I think there are some debugging utils now, or gdb stub, but I have not yet tested them out.
Do you know what
sleep_reset_analog_rtcreg_8266 at ?? line ?is ?
@tablatronix commented on GitHub (Sep 12, 2019):
can you upload a minimal reproducable sketch, with just the params, have you added a test loop to the example to generate 30 etc..
It does seem that the most likely problem is
0x4020dec2: WiFiManager::getParamOut() atand $page string is overflowing
@tablatronix commented on GitHub (Sep 12, 2019):
Did you turn all debugging on ? Esp debugging , you might get some better output before the exception.
it is definitely a memory thing.
`
@dontsovcmc commented on GitHub (Sep 12, 2019):
yes. wait, I prepare it.
I think it doesn't work in platformio.. maybe I do smth wrong? Can you write an example of ini file? or any defines for debug?
yes. if i descrese parameters number it works, increase - exception in getParamOut()
@tablatronix commented on GitHub (Sep 12, 2019):
here you go
build_flags = -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI@dontsovcmc commented on GitHub (Sep 12, 2019):
Thanks a lot for you help!
Wow, build_flags works! hm.. last time not.
main.cpp https://pastebin.com/NM5bw3bB
now it raises exception. comment some parameters and it will works good.
platformio.ini
@tablatronix commented on GitHub (Sep 12, 2019):
I rolled back to esp 2_3_0 and get the same crash
@dontsovcmc commented on GitHub (Sep 12, 2019):
Only 2.0.4 works. I think, I need to find commit in Arduino framework between 2.20500.0 and 2.20501.0.
Platformio is only building features.
@tablatronix commented on GitHub (Sep 12, 2019):
That is a very long time ago, a whole different sdk etc. I am betting fragmenting memory from string, maybe something changed that leads to more possibility of fragmentation of heap, we can try to figure it out, ideally we need to just change it to use a a proper buffer.
@dontsovcmc commented on GitHub (Sep 13, 2019):
I can't believe, that we are alone with this framework difference.
I try to add String &page argument to getParamOut(), also add page.reserve(8000). Memory count changes but exception raised.
@dontsovcmc commented on GitHub (Sep 13, 2019):
@tablatronix do you know about this https://arduino-esp8266.readthedocs.io/en/latest/PROGMEM.html ? I use PROGMEM string with WifiManager, that don't have _P() functions to works with this type of strings... I check it
@tablatronix commented on GitHub (Sep 13, 2019):
all html strings are in progmem, I have no idea how you that would work with non constants
@dontsovcmc commented on GitHub (Sep 13, 2019):
IT WORKS! Without PROGMEM string for parameters...
I think, somewhere is wrong function for Progmem strings...
p.s. also https://forums.adafruit.com/viewtopic.php?f=56&t=106457#wrap
@tablatronix commented on GitHub (Sep 13, 2019):
what did you do , put your own sketch strings in progmem ?
@tablatronix commented on GitHub (Sep 13, 2019):
It looks like the webserver already has this, I wonder if it has a send buffer and we can just write to it then send instread of concatenating our own string..
I have not worked much with the webserver.
ESP8266WebServer::send_P
@tablatronix commented on GitHub (Sep 13, 2019):
It also has methods with params for code and content_type, I wonder if we can get rid of sending our own headers now.
@tablatronix commented on GitHub (Sep 13, 2019):
Ok I see no buffer, so is it as easy as using PSTR() ?
@dontsovcmc commented on GitHub (Sep 13, 2019):
Now I make "easy" changes - remove "PROGMEM" everywhere. But, I think, It better understand behaviour for WifiManager.
Maybe using const char * in functions arguments is wrong?
Like this: https://github.com/dontsovcmc/waterius/blob/master/ESP8266/src/setup_ap.h#L20
All my strings are custom HTML:
https://github.com/dontsovcmc/waterius/blob/master/ESP8266/src/setup_ap.cpp#L126
i see this patch and think my code is wrong:
https://github.com/esp8266/Arduino/issues/4323
This is what I need: const char * footer = String(F("\r\n")).c_str();
@tablatronix commented on GitHub (Sep 13, 2019):
ok so how did you fix it ???
remove progmem ?
Can you use F() strings?
@dontsovcmc commented on GitHub (Sep 13, 2019):
yes, remove PROGMEM in my code. I try it today night. Write here result
@dontsovcmc commented on GitHub (Sep 13, 2019):
Show nothing on the screen:
Crash:
OK:
and also:
@dontsovcmc commented on GitHub (Sep 14, 2019):
It's interesting, that WiFiManager fails if
1.
build_flags = -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFIalso with
build_flags = -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_COREWITHOUT any CustomParameters (!)
@dontsovcmc commented on GitHub (Sep 14, 2019):
oups... i think it's look like this bug: https://github.com/esp8266/Arduino/issues/4372#issuecomment-411895439
I change WiFi.mode(WIFI_STA); to WiFi.mode(WIFI_OFF); in setup(), add WiFi.mode(WIFI_AP) before ConfigPortal and it works:
So I see (only with -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_CORE):
WiFi.mode(WIFI_STA); + startConfigPortal() - exception
WiFi.mode(WIFI_OFF); + WiFi.mode(WIFI_AP); + startConfigPortal() - OK
@dontsovcmc commented on GitHub (Sep 14, 2019):
offtopic
@tablatronix commented on GitHub (Sep 14, 2019):
very interesting
@dontsovcmc commented on GitHub (Sep 15, 2019):
I think we should add remark to listing or documentation, that using PROGMEM strings with WifiManagerParameter is prohibited.
I can't understand how to add support.
I think it's not necessary cause a little number of cases such this. So remark is best way.
@tablatronix commented on GitHub (Sep 16, 2019):
Yeah I am not entirely sure why, not sure I fully understand whats going on
@dontsovcmc commented on GitHub (Sep 16, 2019):
@tablatronix I try to describe:
in esp PROGMEM string must be used only by special fuctions: memcmp_P, strlen_P and etc.
Working with PROGMEM strings with common functions "strlen", "memcmp", "scanf" is dangerous (read "prohibited").
What's why this "operator=" can raise exception:
https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.cpp#L543
Look at String contructors:
https://github.com/esp8266/Arduino/pull/6450#issuecomment-531651119
@tablatronix commented on GitHub (Sep 16, 2019):
ok, so we would have to add some checking to avoid exceptions, a note for now will work.
Of course it might be possible to rework some stuff to allow pstrings
@dontsovcmc commented on GitHub (Sep 16, 2019):
@tablatronix I can't understand how to check it =(. Only add functions with
const __FlashStringHelper *.