lavinir / hassio-onedrive-backup

MIT License
222 stars 5 forks source link

Backup fails with lots of errors #56

Open Tokn59 opened 1 year ago

Tokn59 commented 1 year ago

Hi, I recently installed the Onedrive Backup add-on (thank you for sharing this !) but can't get it to work. I authorized the add-on with the provided code but I keep getting tons of errors. Any idea what is going wrong ? Thank you !!!!

at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) at System.Net.Http.HttpClient.gCore|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Graph.SimpleHttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.SimpleHttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.UploadSliceRequest1.SendRequestAsync(Stream stream, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.UploadSliceRequest1.PutAsync(Stream stream, CancellationToken cancellationToken) at Microsoft.Graph.LargeFileUploadTask1.UploadSliceAsync(UploadSliceRequest1 uploadSliceRequest, ICollection1 exceptionTrackingList) at Microsoft.Graph.LargeFileUploadTask1.UploadAsync(IProgress1 progress, Int32 maxTries) at hassio_onedrive_backup.Graph.GraphHelper.UploadFileAsync(String filePath, DateTime date, String instanceName, String destinationFileName, Action1 progressCallback, Boolean flatten, Boolean omitDescription) in /src/Graph/GraphHelper.cs:line 166 03/09/2023 08:28:19 [18] Info: Backup Interval Completed. at hassio_onedrive_backup.Hass.BackupManager.PerformBackupsAsync() in /src/Hass/BackupManager.cs:line 114 at hassio_onedrive_backup.Program.Main(String[] args) in /src/Program.cs:line 89 03/09/2023 08:33:20 [42] Info: Checking backups 03/09/2023 08:33:20 [42] Info: Retrieving existing local backups... 03/09/2023 08:33:20 [42] Info: Retrieving existing online backups... 03/09/2023 08:33:20 [42] Info: Last local backup Date: 03/08/2023 13:28:24 03/09/2023 08:33:20 [42] Info: Last online backup Date: 03/08/2023 12:01:43 03/09/2023 08:33:20 [42] Info: Found 1 backups to upload. 03/09/2023 08:33:20 [42] Info: Uploading hass_backup_2023-03-08-13-28 (03/08/2023 13:28:24) 03/09/2023 08:33:20 [42] Info: Fetching Local Backup (Slug:d51217b6) 03/09/2023 08:34:24 [39] Info: Backup (d51217b6) fetched successfully 03/09/2023 08:34:25 [41] Info: Starting file upload. (Size:3219025920 bytes. Attempt: 1/3) 03/09/2023 08:36:07 [26] Error: Unexpected error. System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing. ---> System.TimeoutException: A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. 03/09/2023 08:36:07 [26] Info: Backup Interval Completed. at System.Net.Http.Http2Connection.SendStreamDataAsync(Int32 streamId, ReadOnlyMemory1 buffer, Boolean finalFlush, CancellationToken cancellationToken) at System.Net.Http.Http2Connection.Http2Stream.SendDataAsync(ReadOnlyMemory1 buffer, CancellationToken cancellationToken) at System.IO.Stream.g__Core|29_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken) at System.Net.Http.StreamToStreamCopy.gDisposeSourceAsync|1_0(Task copyTask, Stream source) at System.Net.Http.Http2Connection.Http2Stream.SendRequestBodyAsync(CancellationToken cancellationToken) at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at Microsoft.Graph.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Graph.RetryHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.CompressionHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpClient.gCore|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Graph.SimpleHttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.SimpleHttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.UploadSliceRequest1.SendRequestAsync(Stream stream, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.UploadSliceRequest1.PutAsync(Stream stream, CancellationToken cancellationToken) at Microsoft.Graph.LargeFileUploadTask1.UploadSliceAsync(UploadSliceRequest1 uploadSliceRequest, ICollection1 exceptionTrackingList) at Microsoft.Graph.LargeFileUploadTask1.UploadAsync(IProgress1 progress, Int32 maxTries) at hassio_onedrive_backup.Graph.GraphHelper.UploadFileAsync(String filePath, DateTime date, String instanceName, String destinationFileName, Action1 progressCallback, Boolean flatten, Boolean omitDescription) in /src/Graph/GraphHelper.cs:line 166 at hassio_onedrive_backup.Hass.BackupManager.PerformBackupsAsync() in /src/Hass/BackupManager.cs:line 114 at hassio_onedrive_backup.Program.Main(String[] args) in /src/Program.cs:line 89 03/09/2023 08:41:08 [13] Info: Checking backups 03/09/2023 08:41:08 [13] Info: Retrieving existing local backups... 03/09/2023 08:41:08 [16] Info: Retrieving existing online backups... 03/09/2023 08:41:08 [16] Info: Last local backup Date: 03/08/2023 13:28:24 03/09/2023 08:41:08 [16] Info: Last online backup Date: 03/08/2023 12:01:43 03/09/2023 08:41:08 [16] Info: Found 1 backups to upload. 03/09/2023 08:41:08 [16] Info: Uploading hass_backup_2023-03-08-13-28 (03/08/2023 13:28:24) 03/09/2023 08:41:08 [16] Info: Fetching Local Backup (Slug:d51217b6) 03/09/2023 08:41:44 [32] Info: Backup (d51217b6) fetched successfully 03/09/2023 08:41:44 [32] Info: Starting file upload. (Size:3219025920 bytes. Attempt: 1/3) 03/09/2023 08:44:42 [15] Error: Unexpected error. System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing. ---> System.TimeoutException: A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. at System.Net.Http.Http2Connection.SendStreamDataAsync(Int32 streamId, ReadOnlyMemory1 buffer, Boolean finalFlush, CancellationToken cancellationToken) at System.Net.Http.Http2Connection.Http2Stream.SendDataAsync(ReadOnlyMemory1 buffer, CancellationToken cancellationToken) at System.IO.Stream.gCore|29_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken) at System.Net.Http.StreamToStreamCopy.gDisposeSourceAsync|1_0(Task copyTask, Stream source) at System.Net.Http.Http2Connection.Http2Stream.SendRequestBodyAsync(CancellationToken cancellationToken) at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at Microsoft.Graph.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Graph.RetryHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.CompressionHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) --- End of inner exception stack trace --- --- End of inner exception stack trace --- 03/09/2023 08:44:42 [15] Info: Backup Interval Completed. at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) at System.Net.Http.HttpClient.gCore|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Graph.SimpleHttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.SimpleHttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.UploadSliceRequest1.SendRequestAsync(Stream stream, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.UploadSliceRequest1.PutAsync(Stream stream, CancellationToken cancellationToken) at Microsoft.Graph.LargeFileUploadTask1.UploadSliceAsync(UploadSliceRequest1 uploadSliceRequest, ICollection1 exceptionTrackingList) at Microsoft.Graph.LargeFileUploadTask1.UploadAsync(IProgress1 progress, Int32 maxTries) at hassio_onedrive_backup.Graph.GraphHelper.UploadFileAsync(String filePath, DateTime date, String instanceName, String destinationFileName, Action1 progressCallback, Boolean flatten, Boolean omitDescription) in /src/Graph/GraphHelper.cs:line 166 at hassio_onedrive_backup.Hass.BackupManager.PerformBackupsAsync() in /src/Hass/BackupManager.cs:line 114 at hassio_onedrive_backup.Program.Main(String[] args) in /src/Program.cs:line 89 03/09/2023 08:49:43 [43] Info: Checking backups 03/09/2023 08:49:43 [21] Info: Retrieving existing local backups... 03/09/2023 08:49:43 [3] Info: Retrieving existing online backups... 03/09/2023 08:49:43 [31] Info: Last local backup Date: 03/08/2023 13:28:24 03/09/2023 08:49:43 [31] Info: Last online backup Date: 03/08/2023 12:01:43 03/09/2023 08:49:43 [31] Info: Found 1 backups to upload. 03/09/2023 08:49:43 [3] Info: Uploading hass_backup_2023-03-08-13-28 (03/08/2023 13:28:24) 03/09/2023 08:49:43 [3] Info: Fetching Local Backup (Slug:d51217b6) 03/09/2023 08:50:26 [11] Info: Backup (d51217b6) fetched successfully 03/09/2023 08:50:27 [11] Info: Starting file upload. (Size:3219025920 bytes. Attempt: 1/3)

lavinir commented 1 year ago

Looks like it's timing out during the backup upload. It's a large file but it breaks it up to ~3MB chunks during upload. From the logs it seems it's not even getting through the initial chunks.

Tokn59 commented 1 year ago

Hi,

Thank you for the quick reply. I can confirm that I toggled all backups OFF and that my upload speed is far better than the 3MB within the 100 sec.

The issue however still continues. Anything else I can try ?

Thanks !!!

From: lavinir @.> Sent: Thursday, 9 March 2023 09:44 To: lavinir/hassio-onedrive-backup @.> Cc: Tokn59 @.>; Author @.> Subject: Re: [lavinir/hassio-onedrive-backup] Backup fails with lots of errors (Issue #56)

Looks like it's timing out during the backup upload. It's a large file but it breaks it up to ~3MB chunks during upload. From the logs it seems it's not even getting through the initial chunks.

- Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flavinir%2Fhassio-onedrive-backup%2Fissues%2F56%23issuecomment-1461576506&data=05%7C01%7C%7Cf4422a775c7e4ebf9e9508db207a6065%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638139482200026268%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=omrxfZ7fxC7K4ROYjOccLhOwoV30YwwMEe489bn0C6I%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACGJZ7YZT4POBAFKWCHW4Y3W3GJ3TANCNFSM6AAAAAAVUXVU4M&data=05%7C01%7C%7Cf4422a775c7e4ebf9e9508db207a6065%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638139482200026268%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=hVtqW%2FFxA3nCJV%2FXAjLlu2ql1PTyCahbtWd59%2FDu6ns%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.**@.>>

lavinir commented 1 year ago

Did you check a network issue perhaps?

Was the addon folder created under your App/ folder in OneDrive? Some things to try:

Tokn59 commented 1 year ago

Hi,

Checked again and indeed with small files it does work. For example add-on backups do work. Largest so far was 10 MB.

The full backups (150 GB) seem to fail due to timeouts.

I am now checking on another location (other home with other Wifi/Network)

From: lavinir @.> Sent: Friday, 10 March 2023 21:38 To: lavinir/hassio-onedrive-backup @.> Cc: Tokn59 @.>; Author @.> Subject: Re: [lavinir/hassio-onedrive-backup] Backup fails with lots of errors (Issue #56)

Did you check a network issue perhaps?

Was the addon folder created under your App/ folder in OneDrive? Some things to try:

- Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flavinir%2Fhassio-onedrive-backup%2Fissues%2F56%23issuecomment-1464421732&data=05%7C01%7C%7C6f84e2d26a7a463a8b2808db21a768c5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638140775115707611%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=a02bYa%2Fzfj4Kj3g%2B%2BqEdIgAYR9S4derYREywYe9T2vk%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACGJZ7YHKMJWPXS6VWQC36TW3OGMLANCNFSM6AAAAAAVUXVU4M&data=05%7C01%7C%7C6f84e2d26a7a463a8b2808db21a768c5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638140775115707611%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zApcHbPNt6kC1Ph%2B9ygxnvppGL%2FI6phsnTp3nJCOjmQ%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.**@.>>

lavinir commented 1 year ago

150GB ? Your logs indicate ~3GB files. WDYM by addon - backups ? just the addons ?

Tokn59 commented 1 year ago

Indeed .. The FULL backup of my HA instance is around that size. This is partly because there's lot of video clips stored in the media folder. These video files are from Frigate NVR. It would be nice if I could exclude the media folder ....

From: lavinir @.> Sent: Monday, 13 March 2023 09:00 To: lavinir/hassio-onedrive-backup @.> Cc: Tokn59 @.>; Author @.> Subject: Re: [lavinir/hassio-onedrive-backup] Backup fails with lots of errors (Issue #56)

150GB ? Your logs indicate ~3GB files. WDYM by addon - backups ? just the addons ?

- Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flavinir%2Fhassio-onedrive-backup%2Fissues%2F56%23issuecomment-1465668977&data=05%7C01%7C%7Cb0374b1f501043c8116408db2398f9b4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638142912151198504%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=iwzVVrURCCm0iiH3dMMYiwpXUjCAYmJi%2F8Z2Q4hOSTI%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACGJZ76WYT2DZVCRLW2AZZTW33HYZANCNFSM6AAAAAAVUXVU4M&data=05%7C01%7C%7Cb0374b1f501043c8116408db2398f9b4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638142912151198504%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=J48T6ntjURdQPK3GLb7CXxRUknr9PY%2BjG9nyYJ%2B7NsE%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.**@.>>

lavinir commented 1 year ago

Hi sorry missed your reply. You can exclude the media folder - this is available in settings. Before further troubleshooting let's try and disable that see if it helps.

lavinir commented 1 year ago

@Tokn59 , do you still have an issue ?

isngofoz commented 1 year ago

Apologies if it is not related, but I think I have similar issues? I realised that the last backup that the add-on did was 4th April despite having a configuration of 3 days interval. I just did a Trigger Backup and it worked.

at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpClient.gCore|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.DriveRequest.GetAsync(CancellationToken cancellationToken) at hassio_onedrive_backup.Graph.GraphHelper.GetFreeSpaceInGB() in /src/Graph/GraphHelper.cs:line 230 04/14/2023 18:38:27 [32] Error: Unexpected error. System.NullReferenceException: Object reference not set to an instance of an object. at hassio_onedrive_backup.Hass.HassOnedriveFreeSpaceEntityState.UpdateOneDriveFreespaceSensorInHass(OneDriveFreeSpaceData freeSpaceData) in /src/Hass/HassOnedriveFreeSpaceEntityState.cs:line 44 at hassio_onedrive_backup.Orchestrator.Start() in /src/Orchestrator.cs:line 90 04/14/2023 19:08:38 [61] Error: Error getting free space: Status Code: 0 Microsoft.Graph.ServiceException: Code: generalException Message: An error occurred sending the request. ---> System.Net.Http.HttpRequestException: Resource temporarily unavailable (graph.microsoft.com:443) ---> System.Net.Sockets.SocketException (11): Resource temporarily unavailable at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp2ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at Microsoft.Graph.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Graph.RetryHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.CompressionHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpClient.gCore|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.DriveRequest.GetAsync(CancellationToken cancellationToken) at hassio_onedrive_backup.Graph.GraphHelper.GetFreeSpaceInGB() in /src/Graph/GraphHelper.cs:line 230 04/14/2023 19:08:38 [61] Error: Unexpected error. System.NullReferenceException: Object reference not set to an instance of an object. at hassio_onedrive_backup.Hass.HassOnedriveFreeSpaceEntityState.UpdateOneDriveFreespaceSensorInHass(OneDriveFreeSpaceData freeSpaceData) in /src/Hass/HassOnedriveFreeSpaceEntityState.cs:line 44 at hassio_onedrive_backup.Orchestrator.Start() in /src/Orchestrator.cs:line 90 04/14/2023 19:13:43 [29] Error: Error getting free space: Status Code: 0 Microsoft.Graph.ServiceException: Code: generalException Message: An error occurred sending the request. ---> System.Net.Http.HttpRequestException: Resource temporarily unavailable (graph.microsoft.com:443) ---> System.Net.Sockets.SocketException (11): Resource temporarily unavailable at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp2ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at Microsoft.Graph.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Graph.RetryHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.CompressionHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.DriveRequest.GetAsync(CancellationToken cancellationToken) at hassio_onedrive_backup.Graph.GraphHelper.GetFreeSpaceInGB() in /src/Graph/GraphHelper.cs:line 230 04/14/2023 19:13:43 [29] Error: Unexpected error. System.NullReferenceException: Object reference not set to an instance of an object. at hassio_onedrive_backup.Hass.HassOnedriveFreeSpaceEntityState.UpdateOneDriveFreespaceSensorInHass(OneDriveFreeSpaceData freeSpaceData) in /src/Hass/HassOnedriveFreeSpaceEntityState.cs:line 44 at hassio_onedrive_backup.Orchestrator.Start() in /src/Orchestrator.cs:line 90 04/15/2023 11:58:07 [70] Info: Found 1 backups to upload. 04/15/2023 11:58:07 [70] Info: Uploading core_2023.4.2 (04/15/2023 11:57:06) 04/15/2023 11:58:07 [70] Info: Fetching Local Backup (Slug:b0f03308) 04/15/2023 11:58:08 [81] Info: Backup (b0f03308) fetched successfully 04/15/2023 11:58:08 [81] Info: Starting file upload. (Size:11939840 bytes. Attempt: 1/3) 04/15/2023 11:58:17 [41] Info: Upload completed successfully 04/15/2023 11:58:18 [41] Info: Found 1 backups to delete from OneDrive. 04/15/2023 11:58:18 [41] Info: Deleting item: addon_a0d7b954_vscode_5.5.3.tar 04/15/2023 11:58:19 [41] Info: Removing 1 local backups 04/15/2023 12:41:53 [57] Info: Creating new backup 04/15/2023 12:41:53 [57] Info: Starting full local backup 04/15/2023 12:52:25 [70] Info: Backup complete 04/15/2023 12:53:18 [70] Info: Found 1 backups to upload. 04/15/2023 12:53:19 [81] Info: Uploading hass_backup_2023-04-15-12-41 (04/15/2023 12:41:53) 04/15/2023 12:53:19 [81] Info: Fetching Local Backup (Slug:d46be571) 04/15/2023 12:53:23 [36] Info: Backup (d46be571) fetched successfully 04/15/2023 12:53:27 [36] Info: Starting file upload. (Size:842352640 bytes. Attempt: 1/3) 04/15/2023 13:05:17 [58] Info: Upload completed successfully 04/15/2023 13:05:17 [58] Info: Found 1 backups to delete from OneDrive. 04/15/2023 13:05:17 [58] Info: Deleting item: hass_backup_2023-03-20-22-14.tar 04/15/2023 13:05:18 [58] Info: Removing 1 local backups

lavinir commented 1 year ago

@isngofoz - I'm confused as to what exactly is not working. The only thing I see in the logs is a failure getting the free space from OneDrive (seems transient). Can you clarify what isn't working properly ? And are you on the latest version ?

isngofoz commented 1 year ago

It is unlikely getting free space from Onedrive is an issue as I have only used 11.6 GB out of 1TB. Unless within the integration there is a limit on the size of the folder that it has requested from Onedrive as I have set up to 20 onedrive backups. I guess with 1TB, why not?

The initial problem started when full backups were not being done for a duration near to 10 days despites a backup interval set to 3 days. I then forced a full backup and it worked.

I initiated the full backup on 15/04 1pm and did not see anything further error logs and on the 19/04 2am it did a full backup on its own, which I assumed is correct as I set my backup to run only between 2 to 5am, so I thought I had fixed the problem by initiating a manual backup.

For a separate reason 19/04 evening, I had to power cycle my home assistant and the error logs started again. See below.

Yes, I have the last version of the integration and home assistant core. I have held off with the HAOS 10 update.

04/19/2023 18:21:27 [8] Info: Backup interval configured to every 72 hours 04/19/2023 18:21:27 [8] Info: Backups / Syncs will only run during these hours: 2,3,4,5 04/19/2023 18:21:27 [8] Info: File Sync Disabled 04/20/2023 10:20:18 [47] Error: Error getting free space: Status Code: 0 Microsoft.Graph.ServiceException: Code: generalException Message: An error occurred sending the request. ---> System.Net.Http.HttpRequestException: Resource temporarily unavailable (graph.microsoft.com:443) ---> System.Net.Sockets.SocketException (11): Resource temporarily unavailable at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp2ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at Microsoft.Graph.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Graph.RetryHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.CompressionHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken) at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Microsoft.Graph.HttpProvider.SendRequestAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.DriveRequest.GetAsync(CancellationToken cancellationToken) at hassio_onedrive_backup.Graph.GraphHelper.GetFreeSpaceInGB() in /src/Graph/GraphHelper.cs:line 230 04/20/2023 10:20:18 [47] Error: Unexpected error. System.NullReferenceException: Object reference not set to an instance of an object. at hassio_onedrive_backup.Hass.HassOnedriveFreeSpaceEntityState.UpdateOneDriveFreespaceSensorInHass(OneDriveFreeSpaceData freeSpaceData) in /src/Hass/HassOnedriveFreeSpaceEntityState.cs:line 44 at hassio_onedrive_backup.Orchestrator.Start() in /src/Orchestrator.cs:line 90

lavinir commented 1 year ago

What I meant about the free space was just querying OneDrive for how much free space is left not that you have an issue with no free space. This is what I see again in these logs. But this error should also prevent any communication with OneDrive. Are backups being uploaded to OneDrive ?

isngofoz commented 1 year ago

Okay, not sure why these errors are happening though. Anyways, I will monitor for a few more days to be sure.

At this stage, my observation is that these errors while not preventing the HA created backups from being uploaded to OneDrive, it is preventing the integration triggered backup (every 72hrs) from being executed and backed-up to OneDrive. The last integration backup was 19/04 and today is the 23/04 so the integration should have triggered a backup by now. I will let it go for a couple of days to conclude this observation. At this stage, my suspicion is that if there are no HA created backups requiring an upload between the 72 hour gap from the last integration triggered backup, the integration will trigger a 72 hours interval backup fine. 15th Apri was a manual triggered backup. image

isngofoz commented 1 year ago

Apologies for taking a while. I have confirmed my suspicions above.

Firstly, I am assuming the backup interval setting below is for this add-on specific backup, where I use it to complete a full backup every 72 hours. image

However as you can see from the backups below, if there were add-on backups happening between 72 hours period, the full backup does not activate until a manual backup is triggered. In this case, I manually triggered a backup on 28/04 and ensure that I did not install any add-ons until 2/05. After the 2/05 add-on triggered full backup, I installed add-ons and there has been no full backups triggered by this add-on since.

This confirms that the 72 hours full backup only activates when there were no add-on backups happening between its 72hours window. Not sure if this is the intent of the add-on but it is certainly not what I understood from the documentation.

image

lavinir commented 1 year ago

You're correct. The logic to determine whether a backup is needed is based on the last backup that exists that is monitored by the addon. So if you configured the add-on to monitor HA upgrade backups what you are describing would fit. I do agree however, this is probably not the best behavior for the auto upgrade backups.

As a workaround, you can set the addon to ignore the auto upgrade backups. I will think about the best way to treat this backups because if they are monitored it's going to be weird to exclude them from all the other rules (max backups, staleness etc.)

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity.