Skip to content

WiFi Freezes on ESP32S3 module some hours later #288

@fernandoleal-cmyk

Description

@fernandoleal-cmyk

Platform

ESP32

IDE / Tooling

Arduino (IDE/CLI)

What happened?

🐛 [ESP32‑S3] WiFi Freezes After Setup When Using ESPAsyncWebServer
Summary:
On ESP32‑S3 modules, the WiFi stack freezes after setup when using ESPAsyncWebServer. The server initializes correctly, and the device boots normally, but after a few seconds or during reconnection attempts, the WiFi becomes unresponsive. This issue does not cause a boot loop — it only affects WiFi stability after setup.

Environment:

  • Board: ESP32‑S3 DevKitC‑1 (N16R8 variant)
  • Framework: Arduino (via PlatformIO and Arduino IDE)
  • PlatformIO Core: [email protected] (Arduino‑ESP32 3.0.0)
  • Flash Mode: DIO, 80 MHz
  • PSRAM: Enabled and disabled (tested both)
  • Partition Scheme: huge_app.csv
  • Libraries:
  • ESPAsyncWebServer (this repo)
  • AsyncTCP (Khoi fork or ESP32Async fork)

Observed Behavior:

  • Device boots normally and runs setup() without issue.
  • AsyncWebServer starts and responds to requests initially.
  • After a few seconds or during WiFi reconnect/disconnect cycles:
  • WiFi stack freezes.
  • No new connections are accepted.
  • Serial output continues, but network is dead.
  • WiFi.disconnect() or WiFi.mode(WIFI_OFF) often triggers the freeze.

Why This Matters:

  • ESP32‑S3 is increasingly used in production projects.
  • The original ESPAsyncWebServer is widely adopted but not fully compatible with newer ESP32 variants.
  • Developers rely on async servers for performance and responsiveness.
  • Freezing WiFi breaks OTA updates, captive portals, and dynamic content delivery.

Hypothesis:

  • The issue may stem from:
  • Internal LwIP stack conflicts on ESP32‑S3.
  • Improper handling of WiFi events in async context.
  • Memory fragmentation or PSRAM interaction.
  • Missing patches for S3 in the original ESPAsyncWebServer.

Suggested Fixes:

  • Review WiFi event handling and reconnection logic for ESP32‑S3.
  • Add conditional compilation for S3-specific behavior.
  • Delay server startup until WiFi is fully connected.
  • Avoid calling WiFi.disconnect() or WiFi.mode(WIFI_OFF) unless necessary.
  • Consider merging improvements from ESP32Async or Khoi Hoang’s fork, which include S3 support.

Temporary Workarounds:

  • Keep WiFi enabled at all times (avoid disconnect/reconnect).
  • Use WiFiManager classic (tzapu) for credential handling.
  • Avoid DNS-based captive portals on S3.
  • Use ESP‑IDF for full control if async behavior is critical.

Final Note:
Thank you for your foundational work on this library. It has enabled countless projects and remains a cornerstone of async development on ESP32. If this repo is no longer maintained, we’d be grateful for a note in the README or a pointer to the recommended successor.
Warm regards,
Fernando
São Gonçalo do Rio Abaixo, Brazil

Stack Trace

No error message. Just freezes wifi conection forcing new boot.
On the block code bellow, a routine to try wifi reconection. No success.

Minimal Reproductible Example (MRE)

// Verifica a cada ciclo se houve falha anterior de WiFi a cada 15 minutos - FALHA WIFI - FALHA NO WIFI
if (!WiFi.isConnected() || integr[9] == false || !conexaoRealAtiva()) {
unsigned long tempoAtual = millis();
if (tempoAtual - ultimoCheckWiFi >= intervaloReconexao) {
ultimoCheckWiFi = tempoAtual;
reconectarWiFiNonBlocking(); // chamada segura e modular
}
} // bloco de correção de WiFi a cada 15 minutos

I confirm that:

  • I have read the documentation.
  • I have searched for similar discussions.
  • I have searched for similar issues.
  • I have looked at the examples.
  • I have upgraded to the lasted version of ESPAsyncWebServer (and AsyncTCP for ESP32).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions