ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
331 stars 132 forks source link

ESP8266: Wdt Reset when using select query #113

Closed Newsoul693 closed 2 years ago

Newsoul693 commented 4 years ago

I use this library to read data from database, when using it, some time orcur wdt reset. I use Esp8266 decoder and see the statement select, getfeild() cause error. This make my esp8266 reset and reset the millis() timer (I use timer for controling ON Off cycle about 1 hour. So when reset, it return zero :( ). Please help me!

ChuckBell commented 4 years ago

I suspect you are running out of memory. Be sure to close and destroy any variables you don’t need. You can also try moving the connect to the loop() method as documented.

On Sep 14, 2019, at 8:14 AM, Newsoul693 notifications@github.com wrote:

I use this library to read data from database, when using it, some time orcur ắt reset. I use Esp8266 decoder and see the statement select, getfeild() cause error. This make my esp8266 reset and reset the millis() timer (I use timer for controling ON Off cycle about 1 hour. So when reset, it return zero :( ). Please help me!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Newsoul693 commented 4 years ago

Here is decoder result: Decoding stack results 0x40202bed: MySQL_Cursor::get_field(field_struct*) at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 380 0x40202cb6: MySQL_Cursor::get_fields() at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 444 0x40205b18: malloc(size_t) at C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266\umm_malloc\umm_malloc.cpp line 1677 0x40202cbf: MySQL_Cursor::get_fields() at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 446 0x40202ab0: MySQL_Cursor::execute(char const*, bool) at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 99 0x4020dc1a: operator new(unsigned int) at ../../../../../dl/gcc-xtensa/libstdc++-v3/libsupc++/new_op.cc line 52 0x40202d14: MySQL_Cursor::get_columns() at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 115 0x40201356: loop() at C:\Users\USER\Desktop\sample/sample.ino line 108 0x40204400: loop_wrapper() at C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266\core_esp8266_main.cpp line 125 Can you help me know why this happen please! If you need, I will send code to your email.

ChuckBell commented 4 years ago

This looks like a classic case of running out of memory. Please post or PM me your sketch and I'll try to suggest changes to treat the problem.

On 9/14/19 9:23 AM, Newsoul693 wrote:

Here is decoder result: |Decoding stack results 0x40202bed: MySQL_Cursor::get_field(field_struct) at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 380 0x40202cb6: MySQL_Cursor::get_fields() at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 444 0x40205b18: malloc(size_t) at C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266\umm_malloc\umm_malloc.cpp line 1677 0x40202cbf: MySQL_Cursor::get_fields() at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 446 0x40202ab0: MySQL_Cursor::execute(char const, bool) at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 99 0x4020dc1a: operator new(unsigned int) at ../../../../../dl/gcc-xtensa/libstdc++-v3/libsupc++/new_op.cc line 52 0x40202d14: MySQL_Cursor::get_columns() at C:\Users\USER\Documents\Arduino\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp line 115 0x40201356: loop() at C:\Users\USER\Desktop\sample/sample.ino line 108 0x40204400: loop_wrapper() at C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266\core_esp8266_main.cpp line 125| Can you help me know why this happen please!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/113?email_source=notifications&email_token=AB6SHYDMVF4D2VZQQ24FO2TQJTQWLA5CNFSM4IWW3U3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6W3YGQ#issuecomment-531479578, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6SHYAXG35JYHN2TD7F7OTQJTQWLANCNFSM4IWW3U3A.

Newsoul693 commented 4 years ago

I have sent the sketch to your email. Please check it :D.

ChuckBell commented 4 years ago

Hi. I think you’re using too much memory. You do not need to use both strings and character arrays. Use only character arrays. Also, you need to use the void free_columns_buffer(); and void free_row_buffer(); after reading columns and rows. Take a look at the show_results() example method in the library. Reduce and KISS with your memory use.

On Sep 15, 2019, at 10:30 PM, Newsoul693 notifications@github.com wrote:

I have sent the sketch to your email. Please check it :D.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/113?email_source=notifications&email_token=AB6SHYGHLMC5YRPRGSNAWVDQJ3VVXA5CNFSM4IWW3U3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6X7E4A#issuecomment-531624560, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6SHYCZCHVCMQOQEAMCVBDQJ3VVXANCNFSM4IWW3U3A.

Newsoul693 commented 4 years ago

free_columns_buffer() and free_row_buffer() are private void, so can I use curmem->close() instead? I have changed these void to public in your library but still get this error :(...

ChuckBell commented 4 years ago

Yes or make them public. :)

On Thu, Sep 19, 2019 at 08:52 Newsoul693 notifications@github.com wrote:

free_columns_buffer() and free_row_buffer() are private void, so can I use curmem->close() instead?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/113?email_source=notifications&email_token=AB6SHYEJMUQULHKAPDXNERLQKNYY3A5CNFSM4IWW3U3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7DLPAA#issuecomment-533116800, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6SHYF6KKF7LXMI5SQ3EXLQKNYY3ANCNFSM4IWW3U3A .