micropython / micropython-lib

Core Python libraries ported to MicroPython
Other
2.38k stars 993 forks source link

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

Open Zuroy opened 1 year ago

Zuroy commented 1 year ago

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

kdesimini commented 1 year ago

Also seeing this issue when trying to connect on the pico.