I had an issue with an Adafruit ESP32 feather S2 connected to a battery.
WiFi running on core 0
Set to go to sleep when the battery hit 3.8v with wake up on a timer of 5min
All worked except on wakeup all seemed ok but the code did not run.
Solution :
WiFi.disconnect();
delay(12000);
ESP.restart();
It seems that without disconnecting the WiFi the software restart fails