Greengrass client devices last will (LWT) messages not firing


We are using the Moquette broker (version 2.3.3) connecting a client device with the python SDK (awsiotsdk==1.11.8) via the following:

lwt = mqtt.Will(
                    'eventType': 'disconnected',
                    'clientId': self._iot_device._config.thing_name

mqtt_connection = mqtt_connection_builder.mtls_from_path(
                connected_future = mqtt_connection.connect()

Client connect and graceful disconnect (power down, kill process) works as-expected, but when we pull the Ethernet cord of our IoT thing the LWT message never fires.

I have tried using QoS=2 but it still doesn't fire. The documentation seems to say that all of this should be supported (

Any idea why this isn't working?

已提問 1 年前檢視次數 261 次
3 個答案

After updating to the latest Nucleus and client libraries we are no longer seeing this issue. Closing.

已回答 1 年前

Hi. Are you trying to get the LWT received at AWS IoT Core? Or just by other clients connected to the Moquette broker?

If the former, then you need to have setup the MQTT Bridge config for the LWT topic, as you perhaps already know.

profile pictureAWS
已回答 1 年前
  • What do you mean that nothing fires? If LWT is being sent upon disconnect, then that's working properly.

  • @MichaelDombrowski-AWS sorry, my comment above was unclear. LWT is being sent on disconnect if I kill the process. LWT is not being sent on timeout-based disconnect, i.e. I pull the Ethernet cord. This is 100% reproducible.

  • Correct, we have the bridge setup to forward to IoT Core. We know this is working correctly, as we get successful disconnect messages on graceful disconnect. It's only when the client disconnects via timeout (pulling the Eth cable) that nothing fires.

  • I'd recommend that you use the EMQX broker in this case. Moquette should be working, but it is certainly possible that something is going wrong there.

  • Switching brokers is not really trivial for us due to the nature of the products we build. Can AWS confirm this functionality exists in the EMQX broker? Can AWS confirm this is an existing bug w/ the Moquette component? Perhaps there's an upstream fix there?


How long are you waiting for LWT message? Do you have other keep-alive settings, etc, set? I just performed a an experiement where I blocked port 8883 from a client and LWT was sent sometime after

已回答 1 年前
  • We have waited upwards of 10 minutes after disconnecting the client's Ethernet cable. The only keep alive setting that we're actively setting is keep_alive_secs=6. Are you testing with any other non-default settings? Can you try disconnecting the client's network connection instead of blocking the port server-side? Not sure if that will result in different behavior.

  • Used same connection settings, but with a 30 second keep alive. Would you mind sharing snippet of code for your client that's subscribed to the will topic?

  • Just re-read everything, didn't realize bridge was in between. So just to clarify, you have client --> bridge --> iot core. And for will message are you subscribed to iot core or bridge?

  • Correct: client -> bridge -> core. We know everything is configured correctly since we get the LWT message (via IoT Core) on graceful disconnect. It's really only when we pull the Eth cord that it doesn't fire.

    All of our client code is posted above in the main question. Were you looking for something else in particular?

    Thank you!

您尚未登入。 登入 去張貼答案。