same problem here.
on a 1:1 model in the lab, it takes several months, but once in production, the esp32 freezes every 6 hours.
I use 3 inputs and one output to control a pump.
I supply directly on the 3.3v with a dc-dc converter 12v 3.3v 2A
once frozen, the esp 32 does strange things:
when it works we have :
input level at 0.01V
and HIGH output level at 3.28V
after a freeze :
input level 1.25V
HIGH output level: 2.28V
on other subjects, some people have added a 50ms tempo in loop(), I've added a 200ms tempo and lowered the esp32 frequency to 160mhz. This seems to hold, but strangely enough, the variables now reset after 3 or 4 hours, as if the esp32 were restarting by itself from time to time

It's better than freezing, but my arduino uno didn't do that. I also have a doubt about the messages on the serial monitor, which are in the code and useless
void loop() {
...
unsigned long previousMillis = 0;
const long interval = 200; // 200 millisecond delay
// Checks if elapsed time exceeds specified interval
if (currentMillis - previousMillis >= interval) {
// Stores current time
Serial.println("wait 200ms");
previousMillis = currentMillis;
tempo100ms();
}
void tempo100ms() {
unsigned long startMillis = millis();
unsigned long currentMillis = startMillis;
while (currentMillis - startMillis < 200) {
// Wait
currentMillis = millis();
}
}