Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mosquitto broker is super slow and No ACK from MQTT server in 10 seconds problem #2655

Closed
delta010 opened this issue Sep 7, 2022 · 9 comments

Comments

@delta010
Copy link

delta010 commented Sep 7, 2022

Describe the issue you are experiencing

mosquitto MQTT broker is slow to respond and tasmota devices with MQTT are not responding.zigbee2mqtt devices are working but slow to respond, tasmota devices are not able to control at all.

Mosquitto` Config

logins:
username: XXXXXXXXXX
password: XXXXXXXXXX
require_certificate: false
certfile: fullchain.pem
keyfile: privkey.pem
customize:
active: false
folder: mosquitto

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Which add-on are you reporting an issue with?

Mosquitto broker

What is the version of the add-on?

6.1.3

Steps to reproduce the issue

...

Anything in the Supervisor logs that might be useful for us?

homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.
2022-09-07 09:18:25.240 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 502, in _async_unsubscribe
    mid = await self.hass.async_add_executor_job(_client_unsubscribe, topic)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 494, in _client_unsubscribe
    _raise_on_error(result)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 728, in _raise_on_error
    _raise_on_errors((result_code,))
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 723, in _raise_on_errors
    raise HomeAssistantError(f"Error talking to MQTT: {', '.join(messages)}")
homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.
2022-09-07 09:18:34.100 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 1439)
2022-09-07 09:19:33.750 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 523)
2022-09-07 09:19:33.761 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 524)
2022-09-07 09:19:33.764 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 525)
2022-09-07 09:19:33.778 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 526)
2022-09-07 09:19:33.782 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 527)
2022-09-07 09:19:33.824 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 528)
2022-09-07 09:19:33.842 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 529)
2022-09-07 09:19:33.854 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 530)
2022-09-07 09:19:33.865 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 531)
2022-09-07 09:19:33.874 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 532)
2022-09-07 09:19:33.878 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 533)
2022-09-07 09:19:33.884 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 534)
2022-09-07 09:19:33.906 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 535)
2022-09-07 09:19:33.931 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 536)
2022-09-07 09:19:33.934 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 537)
2022-09-07 09:19:33.939 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 538)
2022-09-07 09:19:33.943 WARNING (MainThread) [homeassistant.components.mqtt.client] No ACK from MQTT server in 10 seconds (mid: 539)

Anything in the add-on logs that might be useful for us?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/mosquitto.sh
[09:10:40] INFO: Setting up user hassio
[09:10:40] INFO: Certificates found: SSL is available
cont-init: info: /etc/cont-init.d/mosquitto.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun mosquitto (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
s6-rc: info: service legacy-services successfully started
[09:10:41] INFO: Starting NGINX for authentication handling...
[09:10:42] INFO: Starting mosquitto MQTT broker...
2022-09-07 09:10:42: Warning: Mosquitto should not be run as root/administrator.
[09:10:43] INFO: Successfully send discovery information to Home Assistant.
[09:10:43] INFO: Successfully send service information to the Supervisor.

Additional information

the fan is turned off from tasmota UI
Screenshot from 2022-09-07 10-26-04
no change in home assistant UI
fan

@iainp999
Copy link

iainp999 commented Sep 7, 2022

Pretty sure I have the same issue.

Supervised install (sorry) with a sonoff zigbee usb 3.0 stick. in some cases, zigbee devices will talk to zigbee2mqtt (I can see this in the logs), which then fires a message at mqtt. Can sometimes be a few seconds or around a minute or so before anything gets through.

@delta010
Copy link
Author

delta010 commented Sep 8, 2022

also, I think the MQTT broker makes all wifi devices (WLED, Tasmota, ESPhome, and my android phone)disconnect from the wifi network. the Zigbee devices works but the state in the home assistant UI will slow to update (I am not sure this is the problem with MosquittoMQTT broker) correct me if I am wrong.

@mdegat01
Copy link
Contributor

This looks a lot like home-assistant/core#76252

I kind of think this is a core issue actually since you have this exception in your logs:

homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.
2022-09-07 09:18:25.240 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 502, in _async_unsubscribe
    mid = await self.hass.async_add_executor_job(_client_unsubscribe, topic)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 494, in _client_unsubscribe
    _raise_on_error(result)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 728, in _raise_on_error
    _raise_on_errors((result_code,))
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 723, in _raise_on_errors
    raise HomeAssistantError(f"Error talking to MQTT: {', '.join(messages)}")
homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.

The acknowledge (ACK) messages are supposed to be handled by the client library to my understanding so I don't think the broker is at fault here.

@github-actions
Copy link

github-actions bot commented Nov 3, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 3, 2022
@vandalon
Copy link

vandalon commented Nov 8, 2022

I see the same thing on my install

@github-actions github-actions bot removed the stale label Nov 8, 2022
@delta010
Copy link
Author

delta010 commented Nov 9, 2022

I was using zigbee2mqtt, I think that's why the broker is slow. now I have moved to ZHA there is no delay in the broker

@github-actions
Copy link

github-actions bot commented Dec 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 9, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2022
@krisiasty
Copy link

I'm seeing similar issue. This needs further investigation. I'm pretty sure the issue is with mosquitto addon issue - everything seems to work fine for a few days after I restart mosquitto container, but starts slowing down after that, and I'm seeing error messages in multiple places (zigbee2mqtt, homeassistant logs, hassio journal) stating the client was disconnected from mqtt. Unfortunately I can't really recall when the issue started - maybe it was triggered by some underlying hassio and kernel update some few weeks ago?

@lkoniecki
Copy link

Have the same issue. Can not control any device via zigbee since a week.

Home Assistant logs:

Logger: homeassistant.components.mqtt.client
Source: components/mqtt/client.py:749 
Integration: MQTT ([documentation](https://www.home-assistant.io/integrations/mqtt), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+mqtt%22)) 
First occurred: 18:17:58 (70 occurrences) 
Last logged: 18:17:58

No ACK from MQTT server in 10 seconds (mid: 798)
No ACK from MQTT server in 10 seconds (mid: 799)
No ACK from MQTT server in 10 seconds (mid: 800)
No ACK from MQTT server in 10 seconds (mid: 801)
No ACK from MQTT server in 10 seconds (mid: 802)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants