micropython / micropython/micropython-lib

Raspberry Pi Pico W - umqtt clean_session=False -[Errno 12] ENOMEM

Open
#556 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.1k
Avg merge
7d 6h
Merged PRs (30d)
3

Description

Hello,
I'm using a raspberry pi pico w to connect to a mqtt server. The clean sesssion connection works pretty well but when I try to use client.connect(False) it returns the error: OSError: [Errno 12] ENOMEM

Here a snippet of the code:

`
from umqtt.robust import MQTTClient
def mqtt_connect():

client = MQTTClient(client_id, mqtt_server, port, username, pwd,  keepalive=3600)
client.set_callback(on_message)
client.on_message = on_message
while (client.connect(False) != 0):
    print('Waiting for MQTT connection...')
    sleep(1)
print('Connected to %s MQTT Broker'%(mqtt_server))
client.subscribe(topic_sub)
print("Connected to %s, subscribed to %s topic" % (mqtt_server, topic_sub))

return client

`
and the Error:

Waiting for MQTT connection...
Waiting for MQTT connection...
Waiting for MQTT connection...
Waiting for MQTT connection...
Waiting for MQTT connection...
Traceback (most recent call last):
File "", line 189, in
File "", line 71, in mqtt_connect
File "/lib/umqtt/simple.py", line 66, in connect
OSError: [Errno 12] ENOMEM

Can you help me please?

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported connection path on a Raspberry Pi Pico W using the provided mqtt_connect snippet, comparing client.connect(False) with the working clean-session connection. Then inspect /lib/umqtt/simple.py at connect, especially the path reached by connect(False); done means identifying the ENOMEM cause and documenting or fixing the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, raspberry-pi
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.