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

Memory leak - camera/synology #9352

Closed
jladefoged opened this issue Sep 9, 2017 · 36 comments
Closed

Memory leak - camera/synology #9352

jladefoged opened this issue Sep 9, 2017 · 36 comments

Comments

@jladefoged
Copy link

@jladefoged jladefoged commented Sep 9, 2017

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
0.53

Python release (python3 --version):
3.6.2

Component/platform:
Unknown

Description of problem:
Home Assistant starts to eat memory. Usually after a couple of hours.
Issue started in 0.52.1 and is still present in 0.53
When reaching about 1.7gb memory usage the automations stops working correctly and Home Assistant is sluggish.

Expected:

Problem-relevant configuration.yaml entries and steps to reproduce:

Traceback (if applicable):

Additional info:
Using docker release on Synology NAS.
Attached screenshot is total memory usage on my NAS (in Danish, sorry)
1

@adrian-ludwig
Copy link

@adrian-ludwig adrian-ludwig commented Sep 9, 2017

Happens to me too, but after few days.

Loading

@binbin2000
Copy link

@binbin2000 binbin2000 commented Sep 10, 2017

Went from 0.52 to 0.53 earlier today and got the same issues tonight. I believe my memory usage also were around 1,7 GB when HA became really sluggish. CPU usage also went through the roof.

Loading

@binbin2000
Copy link

@binbin2000 binbin2000 commented Sep 10, 2017

Forgot to mention that I'm also running the Docker release on a Synology NAS.

Loading

@marijngiesen
Copy link

@marijngiesen marijngiesen commented Sep 11, 2017

Same here. Didn't have this issue with 0.52.
Also run the Docker image on a Synology NAS.

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 12, 2017

A buddy of mine tested this on 2 different Synology DSM's with same Home Assistant version (0.53) and configuration.
One of them works fine. The other one crashes with a memory leak.

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 13, 2017

Maybe I've should mention that the issue (at least for me) started between 0.52 to 0.52.1

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 22, 2017

Does anyone of you guys use cameras from Synology Surveillance Station in Home Assistant?
I've just disabled mine (synology camera platform) and also a few on the generic camera platfom.

Loading

@binbin2000
Copy link

@binbin2000 binbin2000 commented Sep 22, 2017

Yes, I use them. Did you solve the problem by disabling the cameras?

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 22, 2017

Not sure yet. So far I'm been running 6 hours on 0.53.1 without issues.

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 23, 2017

0.53.1 still stable after 18 hours with cameras disabled.
I'm trying the new 0.54 with cameras enabled now.

Loading

@binbin2000
Copy link

@binbin2000 binbin2000 commented Sep 23, 2017

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 23, 2017

Memory usage is still an issue (at least for me) in 0.54 with the synology camera platform.
I've disabled them and only trying with the generic camera platform now.

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 24, 2017

I been fiddling around and I think this change is the reason there's a memory leak.
#9110
I'm currently using 0.54 but with the aiohttp_client.py file from 0.52 and memory usage is much better.
There ain't a lot of changes from 0.52 to 0.52.1 but this file is one of them.

I have cameras using H.265, H.264 and MJPEG. MJPEG seems to use a lot more memory than the other ones. Maybe because theres more data being transferred?

Loading

@jladefoged jladefoged changed the title Memory leak Memory leak - camera/synology Sep 24, 2017
@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 25, 2017

Well that didn't really help. There's still a memory leak but not as much with the 0.52 file.

But when running on a standard 0.54 with synology camera component and NOT clicking/maximizing the video feeds seems to run okay without a memory leak? A least not on the same scale.
Can anyone confirm/test this? (restart docker container, don't click video feeds after HA has booted and wait)

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Sep 27, 2017

0.54 was stable without additional memory usage for about 42 hours until i've clicked some of the video feeds. Then the memory leak started.

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Oct 8, 2017

Still an issue in 0.55

Loading

@snjoetw
Copy link
Contributor

@snjoetw snjoetw commented Oct 19, 2017

#9959 fixed memory leak issue for me when I tried

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Oct 19, 2017

I've just tested the dev version with a clean setup with only synology cameras.
Memory usage after ~1 hour is ~1.1gb

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Oct 23, 2017

Still an issue in 0.56.1
Memory usage after ~2 hours is ~1.8gb

Loading

@amelchio amelchio reopened this Oct 23, 2017
@pvizeli
Copy link
Member

@pvizeli pvizeli commented Oct 25, 2017

I think that is a bug in aiohttp. Maybe that will be fix with 2.3.1

Loading

@snjoetw
Copy link
Contributor

@snjoetw snjoetw commented Oct 26, 2017

I think something related to SSL is leaking memory. I'm now using http instead of https and memory is pretty stable (ssl without verify is useless anyway).

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Oct 27, 2017

I've set "verify_ssl: false" on the Synology camera component and don't use SSL in HA (never got it to work).

Loading

@snjoetw
Copy link
Contributor

@snjoetw snjoetw commented Nov 6, 2017

This is what I have currently:

camera:
  - platform: synology
    url: http://192.168.1.20:5000    <- this used to be https://192.168.1.20:5001
    username: ***
    password: ***
    timeout: 15

After switching to http, the memory usage is much better and stable even after a week

Loading

@aptonline
Copy link

@aptonline aptonline commented Nov 6, 2017

I’m so glad I’ve found this post I thought I was going mad. I’m having the exact same issues.

Running HA is docker on a Synology DS918+, happened for me on 0.56.x and now 0.57.x after a few hours of use. First time it happened it used the entire memory of the Synology (4GB) and everything became very unresponsive and I have to reboot the Synology. I since set aside 1GB allocated for the HA docker container but again it eats that up that after a few hours and becomes unresponsive.

Are we saying the culprit is the Synology camera component? I have it setup to use surveillance station cameras

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Nov 6, 2017

@aptonline
Try restarting HA and don't click on any of the camera feeds.
Mine works fine until I click on one or more feeds. Then it starts to eat memory.

Loading

@aptonline
Copy link

@aptonline aptonline commented Nov 6, 2017

Yep exactly that. As soon as the image is shown it spikes. I actually thought it was related to the new Ring Camera component as thats giving me lots of errors too. Think I might disable ALL camera components for testing to see what happens.

Loading

@aptonline
Copy link

@aptonline aptonline commented Nov 8, 2017

aiohttp seems to be at 2.3.2 now (https://pypi.python.org/pypi/aiohttp)

Does HA use the latest version with each new build? How can I check to see which version is running on 0.57.2?

Loading

@snjoetw
Copy link
Contributor

@snjoetw snjoetw commented Nov 8, 2017

Looks like it's 2.3.1

requirements_all.txt:

aiohttp==2.3.1

Loading

@snjoetw
Copy link
Contributor

@snjoetw snjoetw commented Nov 8, 2017

@ladefoged81 @aptonline are you guys still seeing memory leak using http instead of https?

Loading

@jladefoged
Copy link
Author

@jladefoged jladefoged commented Nov 8, 2017

@snjoetw
Currently running stable for 1 hour with http and so far no signs of a memory leak.

Loading

@aptonline
Copy link

@aptonline aptonline commented Nov 8, 2017

@snjoetw I can confirm stable since not using HTTPS.

Loading

@snjoetw
Copy link
Contributor

@snjoetw snjoetw commented Nov 9, 2017

Ok then i don’t think it’s a leak in Synology component. Probably like @pvizeli said, it’s due to aiohttp. But I don’t know which issue is it

Loading

@aptonline
Copy link

@aptonline aptonline commented Nov 9, 2017

Probably, still getting a lot of errors in logs. Maybe they will help pinpoint the issue.

https://hastebin.com/ijekojelod.sql

Loading

@balloobbot
Copy link

@balloobbot balloobbot commented Mar 3, 2018

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

Loading

@balloobbot
Copy link

@balloobbot balloobbot commented Jul 26, 2018

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

Loading

@cgarwood
Copy link
Member

@cgarwood cgarwood commented Dec 14, 2018

No additional comments since November 2017. Closing this. Please open a new issue if there's still a problem. 👍

Loading

@cgarwood cgarwood closed this Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

10 participants