Reserve SDK client startup memory before MQTT TLS admission
This commit is contained in:
1 parent
94cc96f234
commit
beb5b69a80
9 files changed
+162
-25
No files matched your search
@@ -58,7 +58,8 @@ single allocation.
|
||||
|
||||
The `mqtt_startup_allowance` component keeps a 24,576-byte internal startup
|
||||
minimum for the default 8,192-byte MQTTBridge worker stack and two active
|
||||
clients. Each SDK client task defaults to 6,144 bytes and its maximum configured
|
||||
clients. Each SDK client task is explicitly configured with a 6,144-byte stack
|
||||
and priority 5 on IDF 4 and 5; its maximum configured
|
||||
receive/transmit buffers total 1,792 bytes. These stacks and buffers total
|
||||
24,064 bytes for two clients, leaving 512 bytes within the existing allowance.
|
||||
This is a minimum allowance, not a complete allocation bound for the clients,
|
||||
@@ -85,8 +86,16 @@ qualification of five simultaneous PSRAM connections or two internal TLS
|
||||
connections.
|
||||
|
||||
The `mqtt` report also names the production runtime admission thresholds.
|
||||
Each attempt requires at least 16 KiB of DMA-capable internal free heap and a
|
||||
4 KiB contiguous DMA block. A TLS attempt without PSRAM requires at least
|
||||
A cold SDK start requires at least 32 KiB of DMA-capable internal free heap
|
||||
and an 8 KiB contiguous DMA block. This includes a separate 16 KiB allowance
|
||||
for its SDK task stack/TCB, receive/transmit/reassembly buffers and transport
|
||||
or configuration objects, alongside the 16 KiB AES reserve. Those ordinary
|
||||
SDK allocations occur after admission and do not use the TLS allocation guard.
|
||||
A retained SDK handle with a stopped task receives the same cold allowance.
|
||||
A warm reconnect keeps its running task and buffers; it requires at least
|
||||
16 KiB free and a 4 KiB contiguous DMA block. The per-client SDK stack is
|
||||
independent of `MQTT_TASK_STACK_SIZE`, which sizes the existing bridge worker.
|
||||
A TLS attempt without PSRAM requires at least
|
||||
60 KiB free and a 17,408-byte contiguous block. PSRAM allocation fallback must
|
||||
leave the 16 KiB DMA reserve available. These thresholds describe free heap at
|
||||
the time of admission; they are not additional linked capacity and the TLS
|
||||
|
||||
@@ -42,8 +42,12 @@ room-server and companion images that enable it.
|
||||
- Schedule initial connections through the normal maintenance loop. Check
|
||||
the actual pending attempt across SDK tasks, rather than assuming a
|
||||
five-second startup delay or 15-second reconnect gap finished a handshake.
|
||||
- Defer a new connection if DMA-capable internal memory has less than
|
||||
16 KiB free or a largest block below 4 KiB. TLS without working PSRAM
|
||||
- Reserve 32 KiB free DMA-capable internal memory and an 8 KiB largest block
|
||||
before starting an SDK client task. This includes a 16 KiB startup allowance
|
||||
above the 16 KiB AES reserve. Retained, running clients need 16 KiB free and
|
||||
a 4 KiB largest block to reconnect. Pin SDK client tasks to their existing
|
||||
6,144-byte default stack; the separate bridge worker remains 8 KiB.
|
||||
TLS without working PSRAM
|
||||
additionally needs 60 KiB free and a 17 KiB largest block. These are
|
||||
conservative admission bounds, not a promise that future allocations succeed.
|
||||
- Prefer PSRAM for TLS allocations and reject an internal fallback that
|
||||
@@ -72,7 +76,7 @@ PSRAM and internal-only modes, fragmented heap, exhausted PSRAM, delayed
|
||||
connection callbacks, retry timing and bounded replies. They do not execute
|
||||
an ESP32 AES peripheral or qualify physical WiFi behavior.
|
||||
|
||||
All 42 focused Python MQTT tests, 1,794 native tests and 31 memory-budget tests
|
||||
All 43 focused Python MQTT tests, 1,794 native tests and 31 memory-budget tests
|
||||
passed. The focused MQTT tests are also connected to the GitHub unit-test
|
||||
workflow.
|
||||
|
||||
|
||||
Reference in new issue
Block a user