aiomqtt icon indicating copy to clipboard operation
aiomqtt copied to clipboard

Mqtt errors

Open vitalerter opened this issue 4 years ago • 4 comments

Hi, sometime I get this exceptions: What can be the reason of them?

  • MqttError('Operation timed out')
  • MqttCodeError('Could not publish message')

vitalerter avatar Jan 24 '21 07:01 vitalerter

"Operation timed out" can occur for different reasons:

  • Your computer failed to send the message in time
  • The server did not respond in time "Could not publish message" can occur due to the timeout.

It's difficult to pinpoint the culprit from the raw exceptions alone. It can be anything from a temporary network failure to a faulty network driver. Maybe you can try with a localhost server and see if that helps. :+1:

frederikaalund avatar Jan 24 '21 14:01 frederikaalund

You can also try to increase the timeout parameter and see if that changes things. The default timeout is 10 seconds.

frederikaalund avatar Jan 24 '21 14:01 frederikaalund

  1. The broker and device not at the same region so maybe there are issue with timeout so I will try this:

You can also try to increase the timeout parameter and see if that changes things. The default timeout is 10 seconds.

  1. Maybe timeout should be different for etch QOS?

  2. Did this two error messages can be for same operation? of publish?

  • for example i try to publish "a" to topic "1" with qos1
  • Then for some reason timeout occur and both messages will received at Exception catch?
try:
  await self.clients.get(broker).publish(topic, msg, qos=1)
except MqttError as identifier:
  _logging.error("Mqtt publishing Failed", extra={
      "data": {"exception": identifier, "message": msg, "topic": topic}})

"Operation timed out" can occur for different reasons:

  • Your computer failed to send the message in time
  • The server did not respond in time "Could not publish message" can occur due to the timeout.

It's difficult to pinpoint the culprit from the raw exceptions alone. It can be anything from a temporary network failure to a faulty network driver. Maybe you can try with a localhost server and see if that helps. 👍

Thanks

vitalerter avatar Jan 25 '21 06:01 vitalerter

Maybe timeout should be different for etch QOS?

That would make sense. Good thing is that timeout is already a parameter so you can do this as a user already. :+1:

As long as you have problems with timeouts in the system, you might also see other strange errors. :) Fix the timeouts first and foremost. Then, if you still get other errors, we can have a look at those. :+1:

frederikaalund avatar Jan 27 '21 16:01 frederikaalund

Hey there, I'm guessing that we can close this as there has been no more discussion. If there's anything left unclear, please reopen!

empicano avatar Jan 04 '24 23:01 empicano