esp32 and EEPROM.h

I have a sketch on an ESP32 which uses SPIFFS.h to load a HTML page and EEPROM.h to save some values. The sketch worked fine a few months ago but now crashes the WiFi with the error:

"Guru Meditaition Error: Core 1 panic'ed (LoadStoreError). Exception was unhandled:"

After a lot of trail and error I have discovered that the problem seems to be caused by the line:

#define EEPROM_SIZE x

If the value of EEPROM_SIZE is 2 the WiFi doesn't crash and the webpage is accesible but obviously some of the values I want to store are lost. If the value of EEPROM_SIZE greater than 2 the WiFi crashes as soon as I attempt to access the webpage in a browser.
I have spent 2 days narrowing the problem down to the EEPROM_SIZE but am stuck as to how to fix the issue.

An ESP32 does not have an eeprom. Why not use SPIFF's to save your values?

It may be that EEPROM.h is not multitasking and multiprocessor aware. When WiFi is used on a ESP32 WiFi is loaded onto core0 and your code is ran on core1, the ESP32 OS freeRTOS takes over system control. There are 3 RAM pools with an ESP32 core0 RAM, core1 RAM, and shared RAM. If EEPROM.h is not aware of a multi-processor multitasking environment EEPROM.h, most likely, is loading into an area it should not.

You can try changing the order that the libraries are loaded, such as loading EEPROM.h last or just use SPIFF's for all the data info storage.

Oh, why now is a problem when it worked some time ago, EEPROM may have been upgraded, you can try switching to an older version or EEPROM.h.

From the EEPROM library folder on the ESP32...

EEPROM

EEPROM is deprecated. For new applications on ESP32, use Preferences. EEPROM is provided for backwards compatibility with existing Arduino applications.
EEPROM is implemented using a single blob within NVS, so it is a container within a container. As such, it is not going to be a high performance storage method. Preferences will directly use nvs, and store each entry as a single object therein.

Thanks for both replies.

Regarding the deprecation: What is "Preferences"?

And so much for backwards compatability, it has broken my sketches.

I will probably use Idahowalker's advice and store my variables in SPIFFS.

steveinaustria:
Regarding the deprecation: What is "Preferences"?

Look in the ESP32 libraries for Preferences and examples of how to use them.