mathworks / thingspeak-arduino

ThingSpeak Communication Library for Arduino, ESP8266 and ESP32
https://thingspeak.com
438 stars 231 forks source link

Stack Smashing protect Failure! #51

Closed karapapas closed 5 years ago

karapapas commented 5 years ago

Hello, I have the following issue, whenever I reach initialization of ThinkgSpeak ThingSpeak.begin(wifiObj); I get an error of "Stack Smashing protect Failure!".

Now, I know in which scenario this occurs, but I don't know what causes it and how to solve it.

Whenever I use ThingSpeak in a simple arduino sketch everything is fine, however, when I use xTaskCreatePinnedToCore for multitasking, I get the error. I guess that this has something to do with the stack size declared in the xTaskCreatePinnedToCore, but no matter how much memory I allocate I keep getting this error.

Please help!

jasontwinters commented 5 years ago

This might be a bug in the underlying Arduino WiFi client. Do you get this error if you use a generic http client application without the ThingSpeak library?

karapapas commented 5 years ago

Thank you for your immediate answer, I just found out what was causing it. It was my mistake, I was passing a double in the third parameter of the "writeField" method. ThingSpeak.writeField(myIotChannel, 1, (int)round(meterObj.getCurrentFlowrate()), myIotApiKeyWrite); Once I cast it to an int, I stopped receiving the error. I didn't make any other change, so, I guess that was the problem. What do you think? If you agree, you can close the issue.

jasontwinters commented 5 years ago

From what I understand about Stack Smashing faults, that sounds like it was the cause. I'm glad you figured it out.