Casvt / Kapowarr

Kapowarr is a software to build and manage a comic book library, fitting in the *arr suite of software.
https://casvt.github.io/Kapowarr/
GNU General Public License v3.0
348 stars 12 forks source link

Unable to delete volumes #116

Closed kirillmukhin closed 5 months ago

kirillmukhin commented 6 months ago

Description of the bug Can't delete a volume from the WebUI. When I choose to 'Delete volume', folder on the disk is being removed (if the 'Delete folder' flag was set), but the volume is not removed from the list in the WebUI.

Logs:

[2023-12-16 11:55:11][waitress-4][DEBUG] GET /api/volumes/43
[2023-12-16 11:55:23][waitress-9][DEBUG] DELETE /api/volumes/43
[2023-12-16 11:55:23][waitress-9][INFO] Deleting volume 43 with delete_folder set to True
[2023-12-16 11:55:23][waitress-9][INFO] Deleting volume folder of 43
[2023-12-16 11:55:23][waitress-9][DEBUG] Deleting folders from /content/comics/DC Comics/All Star Superman (2007) until /content/comics/
[2023-12-16 11:55:23][waitress-9][DEBUG] Deleting folder: /content/comics/DC Comics/All Star Superman (2007)
[2023-12-16 11:55:23][waitress-9][ERROR] Exception on /api/volumes/43 [DELETE]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/app/frontend/api.py", line 55, in wrapper
    return method(*args, **kwargs)
  File "/app/frontend/api.py", line 172, in wrapper
    result = method(*args, **kwargs)
  File "/app/frontend/api.py", line 418, in api_volume
    volume.delete(delete_folder=delete_folder)
  File "/app/backend/volumes.py", line 366, in delete
    cursor.execute("DELETE FROM volumes WHERE id = ?", (self.id,))
sqlite3.OperationalError: disk I/O error

To Reproduce

  1. Go to WebUI and open a Volume you want to remove.
  2. Click on 'Delete'
  3. In the 'Delete volume' pop-up select whether or not to 'Delete folder'.
  4. Click 'Delete' button.

Expected behaviour Volume removed from the WebUI and from the disk (if the 'Delete folder' flag was set).

Version info

Kapowarr version v1.0.0-beta-3 Python version 3.8.17.final.0 Database version 10 Database location /app/db/Kapowarr.db Data folder /app

Kapowarr is running as a docker app on TrueNas Scale. TrueNAS-SCALE-23.10.0.1 Kapowarr app in Scale:

App Version: 1.0.0 Chart Version: 1.1.4

Casvt commented 6 months ago

This could be caused by a lot of things.

  1. The database folder is mapped to a folder (instead of a docker volume), and the folder has a non-ext4 filesystem. Check if file locking is possible for the file system. Especially because you're running TrueNAS, this could be a possibility.
  2. The database folder has insufficient permissions. Read, write and execute permissions should be enabled for the folder and all it's files inside.
  3. Not enough ram available for the container (highly unlikely).
  4. Your disk could be in bad shape (unreachable sectors, corrupted, etc).

https://stackoverflow.com/questions/9993555/disk-i-o-error-with-sqlite