mdegat01 / addon-amr2mqtt

HA Addon which runs rtlamr to read IDM power meter data and send to MQTT broker
MIT License
33 stars 15 forks source link

High CPU usage due to log being flooded #91

Closed Gonzalo933 closed 1 year ago

Gonzalo933 commented 1 year ago

Describe the bug From time to time I have seen CPU spikes in my Home Assistant instance. I have tracked the usage to AMR2MQTT addon. During these "high CPU usage interval" the log is being flooded with these messages (hundreds of messages per second):

Error reading samples: EOF

To Reproduce It's hard to reproduce as it happens at random intervals.

Logs

Error reading samples: EOF

(I will update with more info when it happens again)

Environment (please complete the following information):

Gonzalo933 commented 1 year ago

Capture

Gonzalo933 commented 1 year ago

This is a sample of the log

10:19:18.871674 main.go:145: Error reading samples:  EOF
10:19:18.871729 main.go:145: Error reading samples:  EOF
10:19:18.871781 main.go:145: Error reading samples:  EOF
10:19:18.871833 main.go:145: Error reading samples:  EOF
10:19:18.871886 main.go:145: Error reading samples:  EOF
10:19:18.871938 main.go:145: Error reading samples:  EOF
10:19:18.871990 main.go:145: Error reading samples:  EOF
10:19:18.872042 main.go:145: Error reading samples:  EOF
10:19:18.872093 main.go:145: Error reading samples:  EOF
10:19:18.872144 main.go:145: Error reading samples:  EOF
10:19:18.872197 main.go:145: Error reading samples:  EOF
10:19:18.872250 main.go:145: Error reading samples:  EOF
10:19:18.872304 main.go:145: Error reading samples:  EOF
10:19:18.872356 main.go:145: Error reading samples:  EOF
10:19:18.872490 main.go:145: Error reading samples:  EOF
10:19:18.872599 main.go:145: Error reading samples:  EOF
10:19:18.872652 main.go:145: Error reading samples:  EOF
10:19:18.872706 main.go:145: Error reading samples:  EOF
10:19:18.872759 main.go:145: Error reading samples:  EOF
10:19:18.872811 main.go:145: Error reading samples:  EOF
elmigbot commented 1 year ago

This happens to me if I jiggle the USB cable connected to the radio. Restarting the addon will fix it for a while. But to fix it permanently, at least until its jiggled again, I have to restart the VM. (I have a feeling this issue is related to USB pass through to VMs).

The worst part of this is that the log can fill my disk within hours.

This looks to be an upstream issue with rtlamr. I found a similar issue that was resolved. Maybe we should open an issue there.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

alvinchen1 commented 1 year ago

Similar issue for me happening today and for a few weeks.

Environment (please complete the following information):

Add-on version: 2.1.2 Supervisor version: 2023.04.1 Operating system: Home Assistant OS 2023.4.6

I have a Node-Red automation that looks at the Supervisor's AMR2MQTT CPU percent. When it is greater than 3.5% for ten minutes (which I have determined is the CPU percentage when this issue is occurring), I have Node-Red restart the Add-on and log an alert. It will not perform this automation again for one hour (throttled). Today, it happened 6 times and would have continued until I stopped the Add-on, unplugged my Nooelec USB radio, plugged it back in and restarted the Add-On.