Old code suddenly stopped working - tcp - serial


I have 10 spark cores that connect to a server, get a string that represents time in mllies then wait for a button click to
start a countdown,

It used to work great, now its stuck on getting the response back from the server, we have a log on the server so we see the http request arrives and we send the exact same string as we used to back as the response.

The weird thing is that when I connect the spark to my PC via usb and open a serial connection with it to debug, everything works, it connects to the server receives the response and parse it right, and generally act as expected.

Initially I thought something about the serial is causing the spark to crash so I tried removing all serial interactions, it didn’t help.

I’m at a loss here, any ideas?

Would you mind posting your code? I realize that the sudden nature of the change with no code change shouldn’t require a code post but it might still be useful.

Are all 10 cores suffering from this issue?


Thaks for the reply, found and fixed the bug with better memory management.

String checkForHttpResult() {
    int position = 0;
    memset(httpResponse, 0, httpResponseSize);
  while (client.available())
      if(position < httpResponseSize)
        char letter = client.read();
        httpResponse[position] = letter;
        position += 1;
          // OP: double the array size and copy old content and read again
          httpResponseSize *= 2;
          char* tempResDouble = (char*)malloc(httpResponseSize*sizeof(char));
          memset(tempResDouble ,0,httpResponseSize);
          strncpy(tempResDouble, httpResponse, httpResponseSize/2);
          httpResponse = tempResDouble;
  if (!client.connected()) 
  httpResponse[position] = '\0';
  return httpResponse;

please check the mysterious DNS problem on spark core that use to work but dont after a flash with recent firmware.