-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp32: mbedtls can't allocate in/out buffers on IDF4.x #5303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I didn't know that it's possible to configure the in/out SSL content lengths separately in mbedtls. IMO it'd be good to enable this feature on all ports that use mbedtls, because otherwise SSL connections cost a lot of RAM (ie 16k for incoming, to support all servers, but 4k or so on outgoing data). |
OK, I will send a PR to do that. However, looking at the heap summary in 3.3 (below) is quite interesting and clearly shows why this problem exists now -- there used to be a 154504 byte region in 3.3 which is now split into 79760 + 16648 + 15072 in 4.x.
The 3.3 MicroPython heap is 115008 bytes which came from that now-split 154504 region. On 4.x the MicroPython heap (now 107136 bytes) comes from that 113840 byte region instead. |
A consequence of this fragmentation is that even though setting |
The IDF heap is more fragmented with IDF 4 and mbedtls cannot allocate enough RAM with 16+16kiB for both in and out buffers, so reduce output buffer size. Fixes issue #5303.
To reduce the size of the SSL context on the heap. See issue #5303.
The IDF heap is more fragmented with IDF 4 and mbedtls cannot allocate enough RAM with 16+16kiB for both in and out buffers, so reduce output buffer size. Fixes issue micropython#5303.
To reduce the size of the SSL context on the heap. See issue micropython#5303.
The IDF heap is more fragmented with IDF 4 and mbedtls cannot allocate enough RAM with 16+16kiB for both in and out buffers, so reduce output buffer size. Fixes issue micropython#5303.
To reduce the size of the SSL context on the heap. See issue micropython#5303.
Update TinyUSB
Raised at https://forum.micropython.org/viewtopic.php?f=18&t=7208
At the point that
modussl_mbedtls.c
callsmbedtls_ssl_setup
, the ESP32 heap looks like this:mbedtls_ssl_setup
tries to allocate two 16717 buffers -- the first (ssl->in_buf
) succeeds (likely from the fourth block) then the second (ssl->out_buf
) fails.Easy workaround would be to enable
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN
(which would drop the output buffer to 4kiB).I'll grab the heap info for a 3.3 build. I'm guessing that by chance the fragmentation across the blocks just ends up being slightly more favourable to two >16kiB allocations.
The text was updated successfully, but these errors were encountered: