TCPClient.connect() with hostname causing Hard Fault

I’m using the ThinkSpeak library to log some DS18B20 sensor data. However, when I call ThinkSpeak.writeFields() I get a Hard Fault, red SOS led flash and reboot.

After going through the ThinkSpeak.h code and adding a LOT of extra Serial debugging output I pinned this down to the client connection - by default the library tries the hostname "api.thinkspeak.com" first, and falls back to a default static IP if that returns a failure. If i switch the order of these two, trying to connect to the IPAddress() first, it works every time, and I’m now successfully logging data.

Is this a new problem? I wasn’t able to find any recent posts about this kind of problem, and it works fine if I build examples through the web gui. @mdma Is this possibly due to me using GCC v5.3.0? I’ll try to produce a SSCCE tomorrow, for now I’m just happy to go to bed with working code!

Well, it seems like I have some weird corruption going on somewhere that’s affecting string handling in a number of places.

I have calls like snprintf(outputStr, 64, "<<format with 6x %.2f>>", <<6 doubles>>); and Serial.printf("<<format with 4x %.2f>>", <<4 doubles>>); that cause hard faults (I’m using C strings everywhere).

I’m waiting for an ST-Link clone to arrive to debug further and get more insight on what’s causing the faults.