Skip to content

ESP32 OSError: [Errno 12] ENOMEM urequests #8628

@chriscmorgan

Description

@chriscmorgan

I am getting the ENOMEM error when trying to use urequests to get data from our https api server. The error only occurs if BLE is also active at the same time. This didn't occur in 1.17 but using 1.18 now its happening. I needed the extra memory that 1.18 gives so in a bit of a bind. I am using the esp32-c3-wroom-2 (4MB RAM).

import bluetooth
ble = bluetooth.BLE()
ble.active(True)
config = station.ifconfig()
print (config[0])

request_url = 'https://<api server>' 
gc.collect()
print("Memory Free-8")
print(gc.mem_free())
print("before api request")

res = urequests.post(request_url, headers = {'content-type': 'application/json'}, data = post_data)
print(res)
print("after api request")

Error:

192.168.137.238
Memory Free-8
91408
before api request
Traceback (most recent call last):
  File "<stdin>", line 77, in <module>
  File "/mnt/c/Users/chris.morgan/Documents/code/ilume-hub-firmware/lib/urequests.py", line 60, in request
OSError: [Errno 12] ENOMEM

This error occurs only occurs on esp32c3-20220117-v1.18.bin but on esp32c3-20210902-v1.17.bin is works without error.
If I disable BLE it also works on 1.18 but I need it enabled all the time for my application.
I want to use 1.18 as 1.17 only enabled half the memory that 1.18 does and my application requires more memory.

Any help is really appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions