Closed rybertm-old closed 4 years ago
I am not certain, but I suspect you're running out of memory. Try adding methods to track the memory you're using. If there is less than about 800 bytes of user data left, it can become unstable and random reboots are one of the results.
@ChuckBell thank you for the response, I don't think it's a memory issue, but rather asynchronous callbacks doesn't allow delay/yield function calls, which is what "MySQL_Connection.cpp" does on
boolean MySQL_Connection::connect(IPAddress server, int port, char *user, char *password)
on line 71:
71: delay(CONNECT_DELAY_MS);
Tried to change it by using a simple while
but it still won't connect to the db server.
obs: I am trying to make a connection per query rather than connecting once and keeping it open.
I got these from memory checks:
getFreeHeap: 30384
getHeapFragmentation: 1
getMaxFreeBlockSize: 30248
getFreeContStack: 2352
I don't think you'll be able to use the connector in that manner. It is written so that you must read all rows when executing a query. So, an asynchronous model may timeout or just not work. At least, not how it is currently implemented.
I see that now, thank you for the the help. Closing as it’s working as intended.
I'm using my ESP as a WebServer using AsyncWebServer library, I'm trying to execute some queries as response from a HTTP request from the server, but when I do it resets the board.
I tried 2 approaches: 1- Connect once in
setup()
and run queries when needed, which resets the board. 2- Connect whenever i need to run a query, which doesn't connect to the db server.OBS: When running queries in the regular
loop()
it works fine with either of these approaches.Here's relevant code and reset decoded from first approach:
Query:
Reset: