nextcloud / previewgenerator

Nextcloud app to do preview generation in the background.
https://apps.nextcloud.com/apps/previewgenerator
GNU Affero General Public License v3.0
455 stars 57 forks source link

Crashes when encountering an invalid share #418

Closed jcharaoui closed 4 months ago

jcharaoui commented 1 year ago

When generating previews using php occ preview:generate-all -- <username>, the process crashes with an exception:

2023-09-21T19:27:50-04:00 In DAV.php line 882:
2023-09-21T19:27:50-04:00
2023-09-21T19:27:50-04:00   [OCP\Files\StorageInvalidException]
2023-09-21T19:27:50-04:00   Sabre\HTTP\ClientHttpException: Unauthorized
2023-09-21T19:27:50-04:00
2023-09-21T19:27:50-04:00
2023-09-21T19:27:50-04:00 Exception trace:
2023-09-21T19:27:50-04:00   at /home/nextcloud/www/lib/private/Files/Storage/DAV.php:882
2023-09-21T19:27:50-04:00  OC\Files\Storage\DAV->convertException() at /home/nextcloud/www/lib/private/Files/Storage/DAV.php:299
2023-09-21T19:27:50-04:00  OC\Files\Storage\DAV->propfind() at /home/nextcloud/www/lib/private/Files/Storage/DAV.php:340
2023-09-21T19:27:50-04:00  OC\Files\Storage\DAV->file_exists() at /home/nextcloud/www/apps/files_sharing/lib/External/Storage.php:247
2023-09-21T19:27:50-04:00  OCA\Files_Sharing\External\Storage->file_exists() at /home/nextcloud/www/lib/private/Files/Storage/Wrapper/Wrapper.php:224
2023-09-21T19:27:50-04:00  OC\Files\Storage\Wrapper\Wrapper->file_exists() at /home/nextcloud/www/lib/private/Files/Storage/Wrapper/Wrapper.php:224
2023-09-21T19:27:50-04:00  OC\Files\Storage\Wrapper\Wrapper->file_exists() at /home/nextcloud/www/lib/private/Files/Storage/Wrapper/Availability.php:244
2023-09-21T19:27:50-04:00  OC\Files\Storage\Wrapper\Availability->file_exists() at /home/nextcloud/www/lib/private/Files/Storage/Wrapper/Wrapper.php:224
2023-09-21T19:27:50-04:00  OC\Files\Storage\Wrapper\Wrapper->file_exists() at /home/nextcloud/www/lib/private/Files/View.php:1330
2023-09-21T19:27:50-04:00  OC\Files\View->getCacheEntry() at /home/nextcloud/www/lib/private/Files/View.php:1374
2023-09-21T19:27:50-04:00  OC\Files\View->getFileInfo() at /home/nextcloud/www/lib/private/Files/Node/Root.php:202
2023-09-21T19:27:50-04:00  OC\Files\Node\Root->get() at /home/nextcloud/www/lib/private/Files/Node/Folder.php:135
2023-09-21T19:27:50-04:00  OC\Files\Node\Folder->get() at /home/nextcloud/www/lib/private/Files/Node/Folder.php:144
2023-09-21T19:27:50-04:00  OC\Files\Node\Folder->nodeExists() at /home/nextcloud/www/apps/previewgenerator/lib/Command/Generate.php:199
2023-09-21T19:27:50-04:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /home/nextcloud/www/apps/previewgenerator/lib/Command/Generate.php:210
2023-09-21T19:27:50-04:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /home/nextcloud/www/apps/previewgenerator/lib/Command/Generate.php:190
2023-09-21T19:27:50-04:00  OCA\PreviewGenerator\Command\Generate->generateUserPreviews() at /home/nextcloud/www/apps/previewgenerator/lib/Command/Generate.php:142
2023-09-21T19:27:50-04:00  OCA\PreviewGenerator\Command\Generate->execute() at /home/nextcloud/www/3rdparty/symfony/console/Command/Command.php:298
2023-09-21T19:27:50-04:00  Symfony\Component\Console\Command\Command->run() at /home/nextcloud/www/3rdparty/symfony/console/Application.php:1040
2023-09-21T19:27:50-04:00  Symfony\Component\Console\Application->doRunCommand() at /home/nextcloud/www/3rdparty/symfony/console/Application.php:301
2023-09-21T19:27:50-04:00  Symfony\Component\Console\Application->doRun() at /home/nextcloud/www/3rdparty/symfony/console/Application.php:171
2023-09-21T19:27:50-04:00  Symfony\Component\Console\Application->run() at /home/nextcloud/www/lib/private/Console/Application.php:211
2023-09-21T19:27:50-04:00  OC\Console\Application->run() at /home/nextcloud/www/console.php:100
2023-09-21T19:27:50-04:00  require_once() at /home/nextcloud/www/occ:11
2023-09-21T19:27:50-04:00
2023-09-21T19:27:50-04:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]
2023-09-21T19:27:50-04:00

I think this is caused by the user having a share with another Nextcloud server that's not working anymore:

$ php occ files:scan -- <username>
Starting scan for user 1 out of 1 (<username>)
Exception during scan: Remote share not found
#0 [internal function]: OCA\Files_Sharing\External\Storage->checkStorageAvailability()
[...]

This should be fixed so that the preview generating doesn't crash, but continues to generate the rest of the previews.

mrclschstr commented 4 months ago

I have exactly the same error. However, I fear that this is just a follow-up error, as I also get the same error with occ files:scan. Unfortunately I have no solution. I have already cleaned up with occ sharing:cleanup-remote-storages and occ sharing:delete-orphan-shares, but that did not help.

I would be grateful for any suggestions.