|
|
Heisenbug Sunday, February 23 2025
To debug why the hell my ESP8266 suddenly suffered from memory problems, I followed ChatGPT's instructions to put debugging scripts in the code as close as possible to the place where the memory errors occurred. These dumped information about the heap and the stack, the two consumers of memory that grow towards each other and must, like matter and antimatter, never be allowed to touch. Interestingly, though, the moment this debugging code was in place, the memory errors disappeared. I mentioned this to ChatGPT, which it comically described as "Heisenbug behavior." One of the things I was doing was writing ESP.getFreeHeap() to serial, and ChatGPT seemed to think that ESP.getFreeHeap() can trigger a defragmentation of the heap, which would free up memory needed to do things. I thought it was easier to trigger defragmentation than it was to rework my complicated data structures, so I soon had the code running fairly nicely.
But then at some point I realized that the ESP8266 was only able to receive commands over its serial port for a few seconds after it rebooted. After that, it ignored all serial data. ChatGPT wasn't very helpful getting to the bottom of that problem, and the AI slapped by Google onto their search (which I've never yet found useful) hallucinated an answer that I knew to be wrong. (It claimed the ESP8266 couldn't communicate on WiFi and via serial at the same time, something that, if it were true, would render my SolArk Co-pilot useless.)
For linking purposes this article's URL is: http://asecular.com/blog.php?250223 feedback previous | next |