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

Deleting a backup off a NAS does not refresh HA list #134158

Open
dcmeglio opened this issue Dec 28, 2024 · 6 comments
Open

Deleting a backup off a NAS does not refresh HA list #134158

dcmeglio opened this issue Dec 28, 2024 · 6 comments

Comments

@dcmeglio
Copy link
Contributor

The problem

Setup automatic backups to copy to a NAS.
Run a backup.
-File created on NAS-
Go on NAS and delete that file
Note the list in HA still lists the file even though it doesn't exist. Restarting HA doesn't seem to help.

It you attempt to download the file, it attempts to (and fails to) download a txt file that does not exist.

What version of Home Assistant Core has the issue?

2025.1.0b2

What was the last working version of Home Assistant Core?

NA, new feature

What type of installation are you running?

Home Assistant OS

Integration causing the issue

backup

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: /usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py:451
First occurred: 11:08:17 AM (3 occurrences)
Last logged: 11:13:03 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 480, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/http.py", line 66, in get
    stream = await agent.async_download_backup(backup_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/hassio/backup.py", line 137, in async_download_backup
    return await self._client.backups.download_backup(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/backups.py", line 147, in download_backup
    result = await self._client.get(
             ^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 163, in get
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 129, in _request
    await self._raise_on_status(response)
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 77, in _raise_on_status
    raise exc_type()
aiohasupervisor.exceptions.SupervisorNotFoundError

Supervisor log says:

2024-12-28 11:15:15.148 INFO (MainThread) [supervisor.api.backups] Downloading backup a9200a81

Which a9200a81.txt is the file it attempts to download



### Additional information

_No response_
@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (backup) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of backup 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 backup Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


backup documentation
backup source
(message by IssueLinks)

@mib1185 mib1185 added this to the 2025.1.0 milestone Dec 28, 2024
@def1149
Copy link

def1149 commented Dec 28, 2024

Confirmed when the backup is on a Windows share

@zadigre
Copy link

zadigre commented Dec 29, 2024

same problem here.
also deleting backup stored in a samba share from the backup list doesn't do anything.
problem still present with 2025.1.0 b3

@agners
Copy link
Member

agners commented Dec 30, 2024

Hm, yeah the Supervisor does cache the backup information. There is no event from the (network) file system, and continuously polling would not be good for traffic/IO load. The Core should probably handle this better/differently.

What you can do is use ha backup realod in the CLI to ask Supervisor to (re)check all backup files on disk and network mounts.

@home-assistant
Copy link

Hey there @home-assistant/supervisor, mind taking a look at this issue as it has been labeled with an integration (hassio) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of hassio 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 hassio Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


hassio documentation
hassio source
(message by IssueLinks)

@dcmeglio
Copy link
Contributor Author

dcmeglio commented Dec 30, 2024

It could at least do this as part of HA startup, even restarting HA doesn't cause it to get updated. It could also, once it learns a file has been deleted (e.g. because I tried to download it and it's not there) it could give a user friendly error and at least delete that one from the cache. That would at least provide a better UX than the current downloading an invalid txt file. At least the user would know what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants