Restarting the controller when using sockets in the web server ESP32

This is too unspecific. Which ESP AsyncWebServer is used in your project?
The latest and most similar AsyncWebServer to the original is esp32async/ESPAsyncWebServer@^3.7.0

You may find the root cause for the crash by enabling the ESP32 Exception Decoder:

monitor_filters = esp32_exception_decoder

Please use pre-formatted text when posting logs, code etc.