hivemq-community-edition icon indicating copy to clipboard operation
hivemq-community-edition copied to clipboard

Retained publish not fully processed when connection closes ungracefully

Open xadh00m opened this issue 3 years ago • 3 comments

Expected behavior

If a client publish message (retained, QoS 0,1,2) reaches the broker it should be forwarded to subscribers, the topic should be updated and plugin interceptors should be called even if the client connection closes ungracefully.

Actual behavior

The message is forwarded to subscribers but the topic is not updated and plugin interceptors are not called if the client connection closes ungracefully.

To Reproduce

We can reproduce the issue with the MQTT.js client in Firefox:

window.onbeforeunload = (event) => {  // called by the browser when the webpage closes
  event.preventDefault()
  mqttClient.publish("topic", "payload", { retain: true })
  return ""
}

Details

  • Affected HiveMQ CE version(s): 2021.3-CE container image

xadh00m avatar Jun 02 '22 08:06 xadh00m

@xadh00m

What do you mean with "the topic is not updated"?

DC2-DanielKrueger avatar Oct 20 '22 11:10 DC2-DanielKrueger

Hi @DC2-DanielKrueger,

The retained topic of the broker is not updated. Which means a new subscription to the topic returns the old value. The new value, which has been sent to the previous subscribers, is not retained..

xadh00m avatar Oct 20 '22 11:10 xadh00m

I could not reproduce this by closing the channel right after the publish was sent. Do you know what the js client actually does? Does it sent a DISCONNECT or closes the tcp channel with FIN packet? Is the problem occurring consistently or rather flaky?

DC2-DanielKrueger avatar Oct 21 '22 09:10 DC2-DanielKrueger