Skip to content

Publishing a QOS1 message inside mqttClient.handleMessage() hangs the Node.js process #838

@pantaluna

Description

@pantaluna
mqtt v2.18.2
async-mqtt <master> (that is just a wrapper)

I am using handleMessage(packet, callback). The callback is invoked correctly. The client subscribes to a topic X with QOS1.

The handleMessage() func works OK when not publishing a message inside that function, or when publishing a QOS0 message to another topic Y inside that function.

But when using mqttClient.publish() inside handleMessage() to publish a QOS1 message to another topic Y then the process hangs every time. The call to mqttClient.publish() never returns. No other events are coming in (error, reconnect, offline).

Mosquitto.log

1531088086: New connection from 192.168.0.94 on port 12430.
1531088086: New client connected from 192.168.0.94 as meteohub-mqttjs-bugreport-MYGAMINGPC1 (c0, k60, u'meteohubserver').
1531088086: Sending CONNACK to meteohub-mqttjs-bugreport-MYGAMINGPC1 (1, 0)
1531088086: Sending PUBLISH to meteohub-mqttjs-bugreport-MYGAMINGPC1 (d1, q1, r0, m3, 'meteohub/current/vlocation2', ... (518 bytes))
1531088086: Received SUBSCRIBE from meteohub-mqttjs-bugreport-MYGAMINGPC1
1531088086:     meteohub/current/+ (QoS 1)
1531088086: meteohub-mqttjs-bugreport-MYGAMINGPC1 1 meteohub/current/+
1531088086: Sending SUBACK to meteohub-mqttjs-bugreport-MYGAMINGPC1
1531088086: Received PUBLISH from meteohub-mqttjs-bugreport-MYGAMINGPC1 (d0, q1, r0, m45935, 'meteohub/bugreport', ... (30 bytes))
1531088086: Sending PUBACK to meteohub-mqttjs-bugreport-MYGAMINGPC1 (Mid: 45935)

Is this the expected behavior? Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions