Skip to content

Feature Request: Add setMaxClients() to limit concurrent HTTP connections #365

@VladimirVecera

Description

@VladimirVecera

Platform

ESP32

IDE / Tooling

Arduino (IDE/CLI)

What happened?

Feature Request: There is no way to limit concurrent HTTP connections.

On memory-constrained projects, rapid page navigation causes stack overflow
because too many connections are handled simultaneously.

I would like to request adding setMaxClients() method to AsyncWebServer class,
similar to how AsyncWebSocket has cleanupClients().

Stack Trace

Example crash when rapidly clicking through pages with CONFIG_ASYNC_TCP_STACK_SIZE=3200:

Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (async_tcp)

Note: This is not a bug report - including stack trace only because field is required.
The crash is preventable by increasing stack size, but limiting max clients
would provide better memory control.

Minimal Reproductible Example (MRE)

...

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions