cniles / picow-iot

Example project that uses lwIP MQTT client to connect to a broker and publish a message.
31 stars 0 forks source link

sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty #1

Closed pingufreak closed 1 year ago

pingufreak commented 1 year ago

Hi,

I've implemented a similiar poll-version as you did here too. Anyways, with both versions (mine and yours) I'm getting:

sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty

Do you have an idea why?

In my version I've used pico_cyw43_arch_lwip_threadsafe_background instead of pico_cyw43_arch_lwip_poll later on, but without success.

Maybe FreeRTOS is essential for MQTT?

Thank you!

Kind regards

pingufreak

pingufreak commented 1 year ago

I've increased LWIP_NUM_SYS_TIMEOUT_INTERNAL and it works now.

cniles commented 1 year ago

Thanks for this. I've tried all three setups--Sys, NoSys and polling. When TLS is disabled and communication with the broker is unencrypted I don't see any errors with MQTT. To eliminate potential for thread safety issues with lwip / mbedtls I left it at polling.

I see some messages make it through to subscribers using TLS but eventually the device fails.

Hoping to get around to work with this a little more soon; I see the pico sdk dev branch has some new changes.

Are you using SNTP as well with certificate validation?

pingufreak commented 1 year ago

No problem. My implementation pico_cyw43_arch_lwip_threadsafe_background works with the increased LWIP_NUM_SYS_TIMEOUT_INTERNAL too :). Which doesn't need any polling anymore.

I don't use TLS, because my project is really demanding on battery lifetime. Therefore I'm trying to switch of everything which consumes too much power. DHCP is another thing I'm looking at. Unfortunately, it's hardcoded in the SDK. Means it's not possible to just configure an ip manually and switch off DHCP. Maybe I will create a patch for this if I've time.

GrgoMariani commented 1 year ago

@cniles Great work. The code is really concise and straightforward.

Hopefully you'll also resolve the * * * PANIC * * * with the MQTTS.

Could it be possible that the mbedtls or lwip submodules are outdated?