Skip to content
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

Using platformIO esp8266 panics every few seconds and reboots. #108

Open
bobcroft opened this issue Jan 8, 2023 · 7 comments
Open

Using platformIO esp8266 panics every few seconds and reboots. #108

bobcroft opened this issue Jan 8, 2023 · 7 comments

Comments

@bobcroft
Copy link

bobcroft commented Jan 8, 2023

My issue is identical to an earlier bug reported as 'Kernel panic' , following on from the excellent imformation in that post / reply I set up a basic test using only the following in the loop;

void loop()
{
TBMessage msg;
if (myBot.getNewMessage(msg))
Serial.print("got message");
delay (500);
}
That little snippet is enough to crash the esp8266. Referring to the exception decode even the most basic library example crashes and in all cases there is a reference to the Wstring.h (Ah, the curse of the 'String' versus the 'C' string!) I have also seen exception 9 too.

Serial monitor output;

Starting TelegramBot...

testConnection OK After a few seconds the esp8266 crashes

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (3):
epc1=0x4020b595 epc2=0x00000000 epc3=0x00000000 excvaddr=0x402544fe depc=0x00000000

LoadStoreError: Processor internal physical address or data error during load or store
epc1=0x4020b595 in String::init() at C:\Users\Bob.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:289
(inlined by) String::String(char const*) at C:\Users\Bob.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.cpp:39
excvaddr=0x402544fe in pp_attach at ??:?

stack>>>

I am using the latest version of platformIO under VSC and all libraries are the latest versions.

Further to my earlier comments I installed the Arduino 2.0.3 IDE along with allowing all library and board updates. Initially before the library / board updates I did successfully compile the basic echo example and it ran without crashing BUT it didn't receive or send any messages to telegram. I am of the opinion that either the newer tool chains or library versions break the code resulting in a soft WDT reset. This occurs both under the Ardsuino and platformIO IDE's.

@shurillu
Copy link
Owner

shurillu commented Jan 9, 2023

Hello bobcroft,

the issue that you pointed out is due to a problem with the ArduinoJson v 6.20.0 library. I've done different tests with it, and actually the solution is to use the v6.19.4 of the ArtuinoJson library.
Keep on mind that I have two version of the CTBot:

  • the first is published and is the 2.1.9 that use String variables
  • the other is the 3.0.0 (published in the v3.0.0 branch - you have to download it manually) that use standard C strings and have a lot of new functionalities
    Both have the same issue with the ArduinoJson library v6.20.0.

Hoping that helps, cheers.

Stefano

@bobcroft
Copy link
Author

bobcroft commented Jan 9, 2023 via email

@bobcroft
Copy link
Author

bobcroft commented Jan 9, 2023

Hi Stefano, I have done as you suggested and changed the ArduinoJson version to 6.19.4. I have tried that version along with CTBot v2.1.9 and v3.0.0 on both an ESP32 and a Wemos d1 mini. CTbot V3.0.0 on the ESP 32 compliles, loads and runs to Telegrambot connected OK but it doesn't seem to send or receive any bot messages, it just sits there. I am monitoring bot messgaes on Node-RED so I can check if they are sent and they are sen immediately. The bot also receives messages from NR too.
I tried CTBot V3.0.0 on the Wemos D1 mini, it loads, runs to Telegramconnected OK, reboots a couple of times and then crashes. I have attached a txt file of the very long exception decode.
I do hope you can shed some light on why the ESP8266 is crashing but equally important why the ESP32 doesn't receive bot messages. FWIW I have tried two ther libraries without much sucess either.
CtBot V3 with AJson 6.19.4 decode.txt

@shurillu
Copy link
Owner

Hello Bob,
I've just finished to do some tests. Here my "test rig":

  • Boards: NodeMCU 1.0 (ESP8266) and Node32s (ESP32)
  • ArduinoJson v 6.19.4
  • CTBot v 2.1.9 and 3.0.0
  • ESP8266 toolchain version 3.1.0
  • ESP32 toolchain version 2.0.6
  • VisualStudio with VisualMicro and Arduino IDE v 1.8.15
    Actually I have no strange behavior at all (both boards works with the two CTBot library versions).
    Sorry for the silly question, but in your Arduino libraries folder do you have only one CTBot library?
    In other words, when you switch between the two library version, do you overwrite or keep it both?
    Keeping both (with different folder name) could be an issue.

Let me know and thank you for your feedback!
Cheers,

Stefano

@bobcroft
Copy link
Author

bobcroft commented Jan 11, 2023 via email

@stsdc
Copy link

stsdc commented Apr 12, 2023

I'm using bblanchon/[email protected] and shurillu/CTBot@^2.1.10 on ESP8266. I'm trying to run echoBot example and getting this stacktrace just after testConnection OK message.

0x40100301 in millis at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_wiring.cpp:188
0x401002e5 in millis at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_wiring.cpp:185
0x4020d88e in optimistic_yield at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_main.cpp:150 (discriminator 1)
0x40212174 in esp8266::polledTimeout::timeoutTemplate<false, esp8266::polledTimeout::YieldPolicy::DoNothing, esp8266::polledTimeout::TimePolicy::TimeUnit<esp8266::polledTimeout::TimePolicy::TimeSourceMillis, 1000ull> >::checkExpired(unsigned long) const at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/PolledTimeout.h:238
 (inlined by) esp8266::polledTimeout::timeoutTemplate<false, esp8266::polledTimeout::YieldPolicy::DoNothing, esp8266::polledTimeout::TimePolicy::TimeUnit<esp8266::polledTimeout::TimePolicy::TimeSourceMillis, 1000ull> >::expiredOneShot() const at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/PolledTimeout.h:263
 (inlined by) esp8266::polledTimeout::timeoutTemplate<false, esp8266::polledTimeout::YieldPolicy::DoNothing, esp8266::polledTimeout::TimePolicy::TimeUnit<esp8266::polledTimeout::TimePolicy::TimeSourceMillis, 1000ull> >::expired() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/PolledTimeout.h:163
 (inlined by) esp8266::polledTimeout::timeoutTemplate<false, esp8266::polledTimeout::YieldPolicy::DoNothing, esp8266::polledTimeout::TimePolicy::TimeUnit<esp8266::polledTimeout::TimePolicy::TimeSourceMillis, 1000ull> >::operator bool() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/PolledTimeout.h:169
 (inlined by) BearSSL::WiFiClientSecureCtx::_run_until(unsigned int, bool) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp:468
0x4022b2e2 in br_ssl_engine_hs_reset at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/ssl/bearssl/src/ssl/ssl_engine.c:1320
0x402122b4 in BearSSL::WiFiClientSecureCtx::_wait_for_handshake() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp:585
0x402125f9 in BearSSL::WiFiClientSecureCtx::_connectSSL(char const*) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp:1170
0x40224883 in ip_chksum_pseudo at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/lwip2/builder/lwip2-src/src/core/inet_chksum.c:395
0x4021fef2 in tcp_output at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/lwip2/builder/lwip2-src/src/core/tcp_out.c:1361
0x40105dad in ets_timer_arm_new at ??:?
0x4020df46 in __delay at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_wiring.cpp:54
0x402108d2 in ClientContext::connect(ip4_addr*, unsigned short) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/include/ClientContext.h:148
 (inlined by) WiFiClient::connect(IPAddress, unsigned short) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClient.cpp:162
0x40212788 in BearSSL::WiFiClientSecureCtx::connect(char const*, unsigned short) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp:232
0x40214f48 in std::_Function_base::~_Function_base() at ??:?
0x40214f48 in std::_Function_base::~_Function_base() at ??:?
0x402149ac in BearSSL::WiFiClientSecureCtx::connect(String const&, unsigned short) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp:236
0x4020b386 in BearSSL::WiFiClientSecure::connect(String const&, unsigned short) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h:244
 (inlined by) CTBotSecureConnection::send(String const&) at .pio/libdeps/nodemcuv2/CTBot/src/CTBotSecureConnection.cpp:73
0x401008c9 in umm_free_core at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:549
0x40100ce4 in realloc at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:1125
0x40100b30 in realloc at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:853
0x40214dac in std::_Function_base::~_Function_base() at ??:?
0x4020d028 in String::isSSO() const at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:262
 (inlined by) String::setLen(int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:267
 (inlined by) String::concat(char const*, unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:309
0x4020cde8 in String::move(String&) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:240
0x4020cde8 in String::move(String&) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:240
0x40201550 in String::~String() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:79
 (inlined by) CTBot::sendCommand(String const&, String const&) at .pio/libdeps/nodemcuv2/CTBot/src/CTBot.cpp:30
0x4020cd05 in String::copy(char const*, unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:226
0x4020a2cc in CTBot::getMe(TBUser&) at .pio/libdeps/nodemcuv2/CTBot/src/CTBot.cpp:119
0x40255c8f in pp_attach at ??:?
0x40255cde in pp_attach at ??:?
0x401001e8 in ets_post at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_main.cpp:181
0x40102138 in pp_post at ??:?
0x40254d9b in ppTxPkt at ??:?
0x4023ed9b in ieee80211_send_probereq at ??:?
0x40240bd3 in scan_remove_probe_ssid at ??:?
0x402407a4 in scan_start at ??:?
0x40242e08 in cnx_start_handoff_cb at ??:?
0x40105dad in ets_timer_arm_new at ??:?
0x401042c7 in lmacProcessTXStartData at ??:?
0x401042c4 in lmacProcessTXStartData at ??:?
0x4010322b in wDev_ProcessFiq at ??:?
0x40240794 in scan_start at ??:?
0x40240768 in scan_start at ??:?
0x40240733 in scan_start at ??:?
0x4010307c in wDev_ProcessFiq at ??:?
0x40242e08 in cnx_start_handoff_cb at ??:?
0x4020f22a in esp8266::polledTimeout::timeoutTemplate<true, esp8266::polledTimeout::YieldPolicy::DoNothing, esp8266::polledTimeout::TimePolicy::TimeUnit<esp8266::polledTimeout::TimePolicy::TimeSourceCycles, 1000ull> >::reset(unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/PolledTimeout.h:187
 (inlined by) esp8266::polledTimeout::timeoutTemplate<true, esp8266::polledTimeout::YieldPolicy::DoNothing, esp8266::polledTimeout::TimePolicy::TimeUnit<esp8266::polledTimeout::TimePolicy::TimeSourceCycles, 1000ull> >::timeoutTemplate(unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/PolledTimeout.h:154
 (inlined by) run_scheduled_recurrent_functions() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Schedule.cpp:176
0x4020d7ec in esp_yield at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_main.cpp:123
0x40249a09 in cont_continue at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/cont.S:51
0x4020d028 in String::isSSO() const at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:262
 (inlined by) String::setLen(int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:267
 (inlined by) String::concat(char const*, unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:309
0x40100aed in malloc at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:821
0x40100b30 in realloc at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:853
0x401008c9 in umm_free_core at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:549
0x40100aed in malloc at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:821
0x40100b30 in realloc at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:853
0x4020cb98 in String::changeBuffer(unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:195 (discriminator 4)
0x4020cbc4 in String::changeBuffer(unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:202
0x401008c9 in umm_free_core at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:549
0x40100ab6 in free at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:595
0x4020ca0c in String::init() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:289
 (inlined by) String::invalidate() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:147
0x4020ba39 in String::~String() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:80
 (inlined by) CTBotWifiSetup::wifiConnect(String const&, String const&) at .pio/libdeps/nodemcuv2/CTBot/src/CTBotWifiSetup.cpp:88
0x40100b30 in realloc at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.cpp:853
0x4020cbc4 in String::changeBuffer(unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:202
0x4020b007 in CTBot::testConnection() at .pio/libdeps/nodemcuv2/CTBot/src/CTBot.cpp:105
0x4020cd05 in String::copy(char const*, unsigned int) at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp:226
0x40201840 in CTBot::setTelegramToken(String const&) at .pio/libdeps/nodemcuv2/CTBot/src/CTBot.cpp:101
0x402010f3 in setup at src/main.cpp:27
0x4020d8cf in loop_wrapper() at /home/stsdc/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_main.cpp:198

@shurillu
Copy link
Owner

Hello stsdc,
have you tried the echobot sketch? If not, please try it.
Another question: looking your message, I suppose you are using an ESP8266 board. Which version of the ESP8266 library/toolchain are you using?

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants