-
Notifications
You must be signed in to change notification settings - Fork 639
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
Crashing in SonOff Pow R2 v2.0 (v 1.13.5) #1752
Comments
Can you upgrade to the dev version? See https://github.com/mcspr/espurna-nightly-builder/releases May be related to the #1720, but I am trending towards increased loop delay as a solution for this if it is only related to normal operation. current 1.13.6-dev should space things out more evenly. Another option is that tspk queue eventually fragments the memory (flush method), so webui can crash things. |
Hi mcspr; I will try (but I am having problems building under Windows; ok, it's another subject). Two things:
|
|
Offtopic: Finally I was able to build the current dev version (commit 0998110; task Build (itead-sonoff-pow-r2)). Now what? Can I simply use esptool to flash firmware.bin (generated in .pioenvs/itead-sonoff-pow-r2/) in my Sonoff Pow R2? Is this correct? |
Since 820d8c4 it will keep energy value in RAM between reboots. If you power-off, it will try to recover energy value from flash (if you enabled that option) Note that What do you mean by uptime overflow? Does it stay the same and not increasing between the times you checked? |
"Since 820d8c4 it will keep energy value in RAM between reboots. If you power-off, it will try to recover energy value from flash (if you enabled that option)" "What do you mean by uptime overflow? Does it stay the same and not increasing between the times you checked?" That maybe the variable storing the uptime was too small, but it is not the case .... Ok, maybe what is wrong is the command uptime:
%d? Is it correct? I'm not sure tha it makes any difference but in other parts of the code is used %lu for debug unsigned longs. |
after 1 day and 16 hours running
|
Thanks! Seems like something in async client... Need to take a closer look at thingspeak sender |
Hi, platform,ini references to the async library versión 1.1.3 What is the correct version to use? |
Also; if you can, checks this commit: |
You can use --verbose flag to see which espasynctcp source directory it chooses. |
Not yet..,. Right now I am trying dump objects from firmware.elf to figure what code trhrows the exception; it is located in addres 0x4021ac1f in the two last crashes (using your build), but I am a newby in ESP8266...
Is in PlatformIO some similar tool? |
There is, see addr2line util from toolchain. Or you can use https://github.com/me21/EspArduinoExceptionDecoder to decode multiline stack trace saved in text file |
Ok
in ESPAsyncTCP.cpp:665 there is a blank line between two methods..... Ok, but it command was runnig using my firmware.elf; and my crash log is based on your build. In any case, as soon as I have some time, I will try build and test the lastest dev version using the following fix: in platformio.ini that is; upgrade espAsyncTcp to the version 1.2.0 |
Ok, finally I'm ready to test the fix; I run the task Build: itead-sonoff-pow-r2, but I see something odd:
It seems like a board with 1MBytes of flash, but my sonoff has 4MBytes
Can this bring problems? |
Not big ones, and more on the technical side. espurna/code/espurna/eeprom.ino Lines 118 to 126 in 0998110
|
Well, that is really weird; I am using ESPAsyncTCP to version 1.2.0, and anyway there is the same exception.. Ok, in the trace appears ws.ino; ws.ino is related to ESP Async Webserver; is it possible that Esp Async Webserver get linked to the old ESPAsyncTCP? The version in use (commit 05306e4; version 1.1.0) don't use library.json.... The trace:
decoder ;
(my binary and elf in zip , |
I see different things on the top:
Note that it does not build the other ESPAsyncTCP_ID305 directory. You can make sure of proper dependencies by running pio with Some things that sort of related and also worth checking out:
edit: fix paths, i am running pio-core from git |
'I see different things on the top:' 'changing close(true) to just close()' 'and btw is the crash happening while web interface is open or when opening it?' Well what version ESPAsyncTCP gets linked? I am now sure that it is the correct; I run xtensa-lx106-elf-objdump with option -S; and look in 0x4021abf3 (with my interpretation of assembler in comments...):
Ok, guessing (I don't know almost nothing about xtensa architecture) : I think that problem is not a "null access"; the problem is a more general virtual address exception; for some reason, _pcb gets stored in a invalid address and then l32i.n fails .... |
Aha! I completely forgot that I installed toolchain from the platform-espressif8266@2.2.2, you might want to run some project with it as a platform. There would be toolchain-xtensa (which I used, correct paths) and old toolchain-xtensa@1.40802.0 (broken paths)
Yes. false is the default, so either way. With it, asynctcp waits a bit to trigger disconnect using it's internal loop This WiFi disconnection thing also came up in #1778 Regarding the pcb, it can also be just garbage at this point. It was not nulled but was destroyed, so we can't use that pointer anymore. |
" maybe it crashes with scanning on? " "Regarding the pcb, it can also be just garbage at this point." Anyway, something like "if(_pcb)" should "never" trigger an exception. |
Only because of WiFi.disconnect() call in scanner function. Given some weird nature of async callbacks and sdk interactions.
It shouldn't. My only explanation left is that we should not re-create AsynClient instance. The destructor does nothing and _pcb is actually this->_pcb. Can |
I think exactly the same: 'this' is null. In assembler the pointer to the object is passed using register a2 (a1 is the stack, a3 is the first parameter of a method, in this case "now"); _pcb is the first member of object; then for calculate is _pcb is not null (for "if (_pcb)") the following instruction is executed:
it loads in a2 the value of memory in address a2 + 0 (it try load _pcb for the next "if" and ,because it is the first member of the object, only add and offset 0); and throws an excepction because a2+0 = 0 (ESP dont let you do a load from low addresses). It is not that _pcb is null, this is null! Probably the problem is thinkspeak.ino
" _tspk_client = NULL; " is very suggestive... The other handlers assumes that it is not null, but who knows when and how that events are raised... I think that there are two possible ways:
I will try the last. PS: by the way, telnet.ino is probably doing similar things |
Hi, I saw your pull request; as soon as I have some time I will try it.
I put the trace, maybe it's helpful:
decoder output:
and elf and bin |
Closing via #1806 |
Hi, my SonOff Pow R2 v2.0 with Espurna 1.13.5 (binay release) is restarting after a certain time.
I only have enabled ThingSpeak (with Clear Cache, and reporting the 7 sensors, current, voltage, etc) and Telnet in STA mode (without this last one also happens). Some screenshots of various telnet commands:
![Crash-uptime-info](https://user-images.githubusercontent.com/20286980/58763595-024df300-8533-11e9-9ca5-29220bce3773.JPG)
![Crash-uptime-info-2](https://user-images.githubusercontent.com/20286980/58763597-0b3ec480-8533-11e9-94cb-95111b879c56.JPG)
![Crash-uptime-info-3](https://user-images.githubusercontent.com/20286980/58763598-1396ff80-8533-11e9-91cd-25b0f61eaa9e.JPG)
Any suggestions?
The text was updated successfully, but these errors were encountered: