diff options
author | Angus Gratton <angus@redyak.com.au> | 2025-01-28 15:31:18 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-02-03 15:02:02 +1100 |
commit | 97f444bfa04408dd510f118baaea5760b93bd892 (patch) | |
tree | fad9b2a90ca9696b473d9a7f7f515215785a9544 /py/modmicropython.c | |
parent | 195bf051153cff1d49b3645c51099e9ff6e1d80d (diff) |
extmod/mbedtls: Try GC before failing to setup socket on esp32, unix.
On mbedTLS ports with non-baremetal configs (mostly esp32, technically also
unix port), mbedTLS memory is allocated from the libc heap. This means an
old SSL socket may be holding large SSL buffers and preventing a new SSL
socket from being allocated.
As a workaround, trigger a GC pass and retry before failing outright.
This was originally implemented as a global mbedTLS calloc function, but
there is complexity around the possibility of C user modules calling into
mbedTLS without holding the GIL. It would be interesting to try making a
generic version for any malloc which fails, but this would require checking
for a Python thread and probably making the GIL recursive.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'py/modmicropython.c')
0 files changed, 0 insertions, 0 deletions