rumqtt icon indicating copy to clipboard operation
rumqtt copied to clipboard

Broker.start() and LinkRx.recv() never yield?

Open thomas725 opened this issue 6 months ago • 1 comments

I'm currently trying to debug hangups in my project and what both gdb stacktraces and tokio_console show me - there's something strange going on between tokio & my usage of rumqtt.

The tokio_console give's a clear WARNING: Both my tokio tasks running Broker.start() and LinkRx.recv() never yield back control. I'm using rumqtt 0.19.0 and tokio 1.45.1.

Can you help me debug this issue? Should I do something different? My mqtt code is fairly simple and has 90 lines: https://gitlab.com/thomas351/rust-influxdb-udp-logger/blob/a7f8fa4f7d495da48079a72d8584905b8b2be782/src/mqtt_relay.rs

Image

thomas725 avatar Jun 24 '25 15:06 thomas725

Okey so I think I understand a bit more about sync / async rust than yesterday.

The methods I'm using to start the mqtt broker and listen for notifications are sync rust, so by calling them I'm blocking the callers thread.

Does rumqtt have async versions of Broker.start() and or LinkRx.recv() I could use instead?

For now I've worked around my issues by using the tokio spawn_blocking function instead of spawn. See also: https://gitlab.com/thomas351/rust-influxdb-udp-logger/-/commit/de7cca1876ed5674e9eafa36fff92b459721534c

thomas725 avatar Jun 25 '25 18:06 thomas725