home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.69k stars 30.44k forks source link

Google Calendar integration causes crash/restart of docker container, or lags HA for a few minutes #90116

Closed rubin110 closed 1 year ago

rubin110 commented 1 year ago

The problem

I'm not an expert with Docker.

After setting up the Google Calendar integration and syncing both my personal and work calendars, I observe that the HA docker will crash every ~15m minutes, or python3 -m homeassistant --config /config spikes one of the CPU cores to 100% which causes HA to be unresponsive to a few minutes before becoming usable again. Symptoms disappear after I disable the integration. Both of my calendars are fairly lofty with around 5-10 events per every week day.

Setting logging to debug I see a ton of entries zip by for Google Calendar, which to me look like a sync event, right before the slow down/restart happens.

I thought this issue maybe what others are seeing in #89584, however no one has responded to using the Google Calendar integration too.

What version of Home Assistant Core has the issue?

core-2023.3.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Google Calendar

Link to integration documentation on our website

https://www.home-assistant.io/integrations/google/

Diagnostics information

No diagnostics as it's going to be hard to sanitize the data.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Just a large vomit of calendar sync related logs.

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (google) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `google` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign google` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


google documentation google source (message by IssueLinks)

allenporter commented 1 year ago

This is a new setup? The other bug you commented on is about a specific minor point release, but in this bug you don't specify that an old version used to work.

Do you have an estimate to the total number of events? We may currently be assuming that your calendar can fit in memory but it sounds like you may be saying that isn't the case here which is surprising.

Related: In the events you see zip by how far ahead are they? (Using this to estimate # of events involved here).

If this were crashing because the number of events is too high, what would you expect to happen? Truncate events at some point in the future?

rubin110 commented 1 year ago

Thank you @allenporter for your attention.

This is a new setup? The other bug you commented on is about a specific minor point release, but in this bug you don't specify that an old version used to work.

Sorry I should have clarified #89584 and here. I added in this integration either in 2023.3.0 or 2023.3.1. Initially the symptoms of this issue aren't that drastic, but but 2 weeks ago it got bad enough to notice. Prior to March I have not ever played with the Google Calendar integration.

This specific supervisor install is about 2-3 years old at this point.

Do you have an estimate to the total number of events? We may currently be assuming that your calendar can fit in memory but it sounds like you may be saying that isn't the case here which is surprising.

Doing a search within Gcal's web UI it sadly won't return with a number of event, and when I search for basically everything it will only return a few days into the future/past. When I do an ical export of my calendar to Gcal's "Export calendar" button via the calendar settings, I see...

I want to note that I have about 10 other calendars that the integration is initially pulling in that also have a various more number of events tied to them. I've disabled those entities in HA, but I don't know if that means it won't sync them.

I don't see any overflow in memory over to swap in htop, but also I don't know how Docker does memory management.

Related: In the events you see zip by how far ahead are they? (Using this to estimate # of events involved here).

Let me turn debug logging back on, see if I can capture when the symptoms hit, and then see how much I can sanitize. If you feel comfortable I could email you the logs or private share via Google Drive to a Gmail account?

If this were crashing because the number of events is too high, what would you expect to happen? Truncate events at some point in the future?

That's a really good requirements question, and in my day job I would defer to a Product owner to define 😄. As an average end user who doesn't want to configure more than I need to, I think defaulting to 2 months past and 2 months into the future would be sufficient. As a technically knowledgeable end user, I would like those defaults editable somewhere so I can define something longer or shorter, and tune it as needed if the syncing+system resource issues crop up. Another option is the limit the number of events vs the date range.

allenporter commented 1 year ago

Yeah, you can share with me at allen.porter@gmail.com

allenporter commented 1 year ago

(I usually don't love that you'd need to send me private data to diagnose this, so i may work on a diagnostics platform like I added for local calendar)

rubin110 commented 1 year ago

So as is always the case, I haven't seen the issue crop up now that I've upgraded to 2023.3.6. Mind if I keep this bug ticket open for a few more days and see if the issue returns? Thanks.

allenporter commented 1 year ago

@rubin110 everything still solid?

rubin110 commented 1 year ago

bitmoji