-
Notifications
You must be signed in to change notification settings - Fork 638
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
Backup settings are truncated #896
Comments
The max size of the file might be limited by the available memory since right it created before being sent. Can you check how much free heap you have before trying to do the backu? You can use |
I guess the best option would be to "stream" the contents as they are generated... |
Probably, yeah. Heap getting low looks really strange. Open websocket - it cuts 30 bytes off config :/ Would chunked response + chunked json output help this? i.e. json buffer is kept in memory and https://arduinojson.org/doc/tricks/#chunked-output is used to grab required parts (send out 512 + 512 + 512 + 512 + 265 for 2313) Also, using old version without pretty printer does help - efa88c9#diff-e516855e6c8bb9fe30c150bcc8f9dff4 - ~500 bytes less for 96 keys - it is + 3 spaces, \r\n (plus two for brackets) |
I could not look at the heap size before now, since apparently, the web UI is not reachable via a proxied connection? The free heap is 17904 bytes when the output gets truncated. So, even with a fair amount of memory, this does not work. |
Amending my previous reply... I did some tests since, and have some things to note:
And some calls to DEBUG_MSG can be optimized to happen less frequently (plus, they have some interesting logic for timestamping...) |
Interesting... @mcspr do you mind issuing a PR with your suggested changes? |
@xoseperez Sure. Just need to check if weblog can still work. // about DEBUG_MSG Lines 238 to 239 in f1c2aa1
espurna/code/espurna/utils.ino Lines 268 to 275 in f1c2aa1
e.g. for modules listing: - DEBUG_MSG_P(PSTR("[INIT] SUPPORT:"));
+ DEBUG_MSG_P(PSTR("[INIT] SUPPORT:%s\n"), getEspurnaModules().c_str()); PROGMEM const char espurna_modules[] =
#if ALEXA_SUPPORT
" ALEXA"
#endif
#if BROKER_SUPPORT
" BROKER"
#endif
...
"";
String getEspurnaModules() {
return FPSTR(espurna_modules);
} |
(Sorry, that commit should not be linked to this issue, my bad) |
I have no development environment to compile dev... if anybody can provide the binary for the Sonoff bridge, I can test it. Otherwise, it will have to wait until the weekend. |
@meyergru here's recent git version via travis, built like releases here - https://github.com/mcspr/espurna-travis-test/releases/tag/1.13.0c @xoseperez Would it make sense to delay sending webLog data until the next loop? I got a feeling some of the problems are from doing network request from inside async callback. Or from other log call in some other callback. |
Just tested that 1.13.0c version: No change. Backup was truncated. |
Damn :/ Running the same build right now - heap around ~15088, 13440... Sometimes backup is truncated, sometimes it isn't. (and it should be noted that using curl to test this must be with --digest, like browser does, so it does 2 consecutive requests and with bigger header size) |
Dumping the settings line by lines works fine, the drawback is that they are not alphabetically sorted... |
For web another solution is to just generate file blob from the form, with pure js. No TCP connections that way. Example demonstrating this: #968 |
I just tried version 1.13.0 (the travis build), but the backup file is still corrupted and cannot be imported. My resulting file has 125 lines and is ~3000 bytes now, so it seems as if it is not truncated other than the missing bracket. BTW:
|
Used the wrong build, all is well with 1.13.0. |
Whenever I backup my settings, the resulting JSON file is truncated at some arbitrary point, mostly around 1500 bytes.
This results in a corrupted JSON that cannot be used to restore the settings afterwards. This happens on a Sonoff RF Bridge, BTW and I have used the 1.12.6 release, but 1.12.5 had the issue as well.
The text was updated successfully, but these errors were encountered: