Guru Meditation Error: Core 1 panic'ed (LoadProhibited)

Hey, I have an error that came up suddenly. I am using an ESP32 Dev module

"Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled."

This happens when I fetch a JSON (it's string at first), try and parse it -> doesn't parse it, comes out as "undefined"

Here's an image:
The object prints as a string, but refuses to parse it.

Thanks in advance, any help is appreciated.

Help us help you.

Hey, I'm new here, so my apologies! I'll try and create a list below

  • Here's pretty much the area of my code the issue is coming from. It fetches correctly as sensorReadings prints out. Do note this is a string like I said (I confirmed it with JSON.typeof()
void loop() {

  if ((millis() - lastTime) > timerDelay) {
    //Check WiFi connection status
    if (WiFi.status() == WL_CONNECTED) {

      sensorReadings = httpGETRequest(serverName);
      Serial.println(sensorReadings);

      JSONVar myObject = JSON.parse(sensorReadings);
      Serial.println(JSON.typeof(myObject));

      if (JSON.typeof(myObject) == "undefined") {
        Serial.println("Parsing input failed!");
        return;
      }
}
  • Could say that my question is also that why won't it parse as it seems to be able to do this loop longer and then after a while the Guru Meditation Error comes up.
  • Like I said, I am using an ESP32 Dev kitC v4 development board
  • The code above is a portion of the full code, but is where it happens.
  • Longer error message:

uru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4000c3f0 PS : 0x00060c30 A0 : 0x800d58cc A1 : 0x3ffb1d70
A2 : 0x3ffb1f80 A3 : 0x00000000 A4 : 0x00000001 A5 : 0x0000d77d
A6 : 0x3ffccb60 A7 : 0x0000d77d A8 : 0x00000000 A9 : 0x00000000
A10 : 0x3ffb1da0 A11 : 0x3ffceba4 A12 : 0x0000d77d A13 : 0x3ffdc321
A14 : 0x3ffceba4 A15 : 0x00000d77 SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x4000c3f0:0x3ffb1d70 0x400d58c9:0x3ffb1d90 0x400d59d6:0x3ffb1db0 0x400d0971:0x3ffb1dd0 0x400d0a81:0x3ffb1ed0 0x400d64c1:0x3ffb1fb0 0x4008a7ce:0x3ffb1fd0

Rebooting...

What JSON library are you using?

I recommend ArduinoJson from ArduinoJson.org. They have an "Assistant" that will write most of the code for you, given an example of the JSON document you want to serialize or deserialize.
Assistant | ArduinoJson 6

I am using ArduinoJson, yep

An indicator that a ram access has went beyond its borders. Comon with accessing out of bound arrays or tasks exceeding their allocated stack space.

It worked last night, but the json that is provided from the fetch is shorter during evening than peak day time. Could the length of the provided JSON be the issue then?

Go back to the version from last night.

couple this

and this

and you may be onto something.

I am unable to retreive past information from the api. If you mean the code, it is the same.

If you had read my list, the Guru Meditation Error occurs after the loop has processed a few times. It shows up as undefined each time though

OK. Good luck.

What version? The current version (V6) doesn't have a JSONvar object. It has a JsonVarient object and you need a DynamicJsonDocument or StaticJsonDocument to deserialize it:

// allocate the memory for the document
DynamicJsonDocument doc(1024);

// deserialize the object
char json[] = "42";
deserializeJson(doc, json);

// extract the data
JsonVariant variant = doc.as<JsonVariant>();
int value = variant.as<int>();

I have installed 5.13.5 as a tutorial for setting ESP32 suggested not using v6

Are you sure? You may have it installed but it doesn't look like you are using it. It looks like ArduinoJson V5 doesn't have a JSONvar object type either.

Can you paste in an example of the JSON document you are receiving? Your picture only shows a few lines.

uhhhh, well that's odd. It did work yesterday, how odd. Do you know how I'd do this in 5.13.5 then?

I would switch to the current version (V6) and use the Assistant (linked above) to do most of the work of writing the code.

Some features on the ETS32 may bug then. I'll transfer to that and have a look.

Could you explain how I'd implement the code snippet of V6 to my code?

It seems to work now again, I guess it is too much memory to handle during the peak times. Is there any solution to this other than just getting a board that can handle more memory?

      sensorReadings = httpGETRequest(serverName);
      Serial.println(sensorReadings);

      StaticJsonDocument<1024> doc;

      DeserializationError error = deserializeJson(doc, sensorReadings);

      if (error)
      {
        Serial.print(F("deserializeJson() failed: "));
        Serial.println(error.f_str());
        return;
      }

From that I get 'StaticJsonDocument' was not declared in this scope

@KASSIMSAMJI:
Reached a fun max replies in 24 hours from the forum as a new user, hope you see this...

"HTTP Response code: 200" comes from sensorReadings = httpGETRequest(serverName);
Here is the function:

String httpGETRequest(const char* serverName) {
  WiFiClient client;
  HTTPClient http;

  // Your Domain name with URL path or IP address with path
  http.begin(client, serverName);

  // If you need Node-RED/server authentication, insert user and password below
  //http.setAuthorization("REPLACE_WITH_SERVER_USERNAME", "REPLACE_WITH_SERVER_PASSWORD");

  // Send HTTP POST request
  int httpResponseCode = http.GET();

  String payload = "{}";

  if (httpResponseCode > 0) {
    Serial.print("HTTP Response code: ");
    Serial.println(httpResponseCode);
    payload = http.getString();
  }
  else {
    Serial.print("Error code: ");
    Serial.println(httpResponseCode);
  }
  // Free resources
  http.end();

  return payload;
}