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

Xiaomi Multimode Gateway 2 high CPU load_avg #1420

Open
will-huang9531 opened this issue Aug 11, 2024 · 14 comments
Open

Xiaomi Multimode Gateway 2 high CPU load_avg #1420

will-huang9531 opened this issue Aug 11, 2024 · 14 comments
Assignees
Labels
question Further information is requested

Comments

@will-huang9531
Copy link

After upgrading the Multimode Gateway 1 to Multimode Gateway 2, during a routine inspection, it was found that the CPU load_avg of Multimode Gateway 2 was abnormally high: 9.29|9.15|9.17|2/130|1796 (according to the document, this value should be less than 3). And this gateway has only 25 sub devices.
However, this device did not show any unnormal operation and there were no error logs.

Multimode Gateway 2 Firmwares: 1.0.7_0021 (I have the key)
Gateway3 version: v4.0.5
Home Assistant Core: 2023.12.3

PS: It's interesting that I have a Multimode Gateway 1 in another house, but its load is within the normal range.(2.84|2.73|2.74|1/102|29388)

@AlexxIT AlexxIT added the question Further information is requested label Aug 13, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Aug 13, 2024

You can use telnet to enter gateway's shell and run top command to find out problem application.

@will-huang9531
Copy link
Author

You can use telnet to enter gateway's shell and run top command to find out problem application.

thx for reply
This is what the top command displays.
‘mha_master --log-level 6 --background’
Do you have any ideas about it?
iShot_2024-08-14_17 15 20

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 15, 2024

This is main gateway's application. I'll check my gateway when I have time.

@AlexxIT AlexxIT self-assigned this Aug 15, 2024
@will-huang9531
Copy link
Author

This is main gateway's application. I'll check my gateway when I have time.

I appreciate!
I asked several friends who have the same device, and this seems to be a common situation. If you have time to fix it, we would greatly appreciate it.

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 15, 2024

Maybe it's default behaviour. Better to check situation when integration haven't make any changes with gateway after reboot. Only open telnet.

@will-huang9531
Copy link
Author

will-huang9531 commented Aug 17, 2024

Maybe it's default behaviour. Better to check situation when integration haven't make any changes with gateway after reboot. Only open telnet.

Does this mean that I need to enter the gateway by telnet to use top command without starting the home assistant? That‘s a bit difficult for me to do that.
However, I tried to enter Multimode Gateway 1 by telnet, and use the TOP command, but ‘mha_master --log-level 6 --background’ did not occur.
Does this indicate that this is a unique issue of Multimode Gateway 2?
iShot_2024-08-17_15 21 48

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 17, 2024

It can be unique issue only for model 2.

@AlexxIT
Copy link
Owner

AlexxIT commented Sep 4, 2024

This is my gateway:

firmware: 1.0.7_0021
model: lumi.gateway.mcn001

free_mem: 42060
load_avg: 8.16|8.38|8.48|1/134|867
uptime: 22d14h30m7s

mha_master - 0% load

@Lesnao
Copy link

Lesnao commented Sep 5, 2024

图片

50%cpu too

version 1.0.3_0028

@zalatnaicsongor
Copy link

zalatnaicsongor commented Sep 5, 2024

The issue is simple to fix: turn off z3 support in the openmiio_agent and make sure that mZ3GatewayHost_MQTT is never running.
This is a bug in openmiio_agent that always tries to restart the mZ3GatewayHost_MQTT if the z3 integration is set up even if mZ3GatewayHost_MQTT cannot possibly start up due to an incompatible zigbee firmware version.

Remove the string "z3" from here: https://github.com/AlexxIT/XiaomiGateway3/blob/master/custom_components/xiaomi_gateway3/core/shell/const.py#L2

@will-huang9531
Copy link
Author

mZ3GatewayHost_MQTT

Thank you for your solution, but 'mZ3GatewayHost_MQTT' only consumes a small amount of CPU load ,and the ‘mha_master --log-level 6 --background’ consumes a lot of CPU load. Are you sure there is a correlation between them?

@AlexxIT
Copy link
Owner

AlexxIT commented Sep 6, 2024

I'm also don't see any correlation.

Previous gateway has similar bug. It was because integration restarts MQTT on public port. And sometime main app starts consume a lot of CPU after that. The solution was - restart this main app. I thought this gateway model not affected. mha_master is main app

@zalatnaicsongor
Copy link

ration restarts MQTT on public port. And sometime main app starts consume a lot of CPU after that. The solution was - restart this main app. I thought this gateway model not affected. mha_master is main app

Try it, mha_master is what goes haywire if the mZ3GatewayHost_MQTT is always restarting. Ever since I fixed this, there is no excessive CPU usage on my gateway.

@will-huang9531
Copy link
Author

ration restarts MQTT on public port. And sometime main app starts consume a lot of CPU after that. The solution was - restart this main app. I thought this gateway model not affected. mha_master is main app

Try it, mha_master is what goes haywire if the mZ3GatewayHost_MQTT is always restarting. Ever since I fixed this, there is no excessive CPU usage on my gateway.

If possible, could you please provide your Gateway model, Gateway firmware version, Gateway3 version, and the CPU load? I will try it when I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants