Skip to content

v2.0.31 — WebSocket session leak fix + web upload fix

Choose a tag to compare

@rspaargaren rspaargaren released this 04 Jul 14:17

What's new

Fix: WebSocket session leak (crash prevention)

ws_send_job_fn and ws_send_str cleared the fd from the local tracking array on send failure but never called httpd_sess_trigger_close(). The underlying httpd session (socket slot + lwIP buffer) stayed allocated until LRU eviction, accumulating over hours of continuous operation until max_open_sockets was exhausted and the server entered ENOMEM — producing the socket error storm observed in logs.

Both send-failure paths now call httpd_sess_trigger_close() immediately after clearing the slot, so the httpd session is released promptly.

Fix: web file upload creates parent directories

api_upload_web_post called fopen(path, "w") without creating intermediate directories. LittleFS does not auto-create them. If the directory tree was missing (e.g. after a failed web UI update), all file uploads returned 500. The handler now walks the path and calls mkdir() for each component before opening the file.

Commits

  • 10d0a1d fix: create parent directories in web upload handler
  • 20c7e65 fix: close httpd session when WebSocket send fails

Full Changelog: v2.0.30...v2.0.31


First-time flash via ESP-IDF web upload tool

Select the full.bin for your board — this is a single merged image (bootloader + partition table + app + web UI) that can be flashed to address 0x0.

Board Full image
Heltec ESP32 heltec-v2.0.31-full.bin
LilyGo LoRa32 V1.6.1 (ESP32) lilygo-lora32-v2.0.31-full.bin
LilyGo T3-S3 (ESP32-S3) lilygo-t3s3-v2.0.31-full.bin
  1. Open the ESP-IDF web flash tool
  2. Connect the ESP32 via USB and put it in flash mode (hold BOOT, press EN/RESET, release BOOT)
  3. Click Connect and select the serial port
  4. Set address to 0x0
  5. Click Choose file and select the full.bin for your board
  6. Click Program — flashing takes about 30 seconds
  7. Press EN/RESET to boot

After the first serial flash, all subsequent updates can be done wirelessly via the device web UI (OTA tab → select the firmware.bin for your board).