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

preview generation fails #408

Closed mecpcanada closed 7 months ago

mecpcanada commented 1 year ago

hi preview generation ran for the first time but had to stop it after 15 days as it was taking too long now when i try to run it again i get In File.php line 56: 2023-07-17T12:29:23+00:00 2023-07-17T12:29:23+00:00 [OCP\Files\GenericFileException] 2023-07-17T12:29:23+00:00 2023-07-17T12:29:23+00:00 2023-07-17T12:29:23+00:00 preview:generate-all [-p|--path [PATH]] [--] [...] tried it with next cloud 26 and 27

lExplLicit commented 1 year ago

Solution: Deactivate App, Uninstall App, Install App again. Then run: preview:generate-all -vvv

mecpcanada commented 1 year ago

tried it twice same result

joeywang4 commented 1 year ago

This may help: occ files:scan-app-data Check out the I want to reset/regenerate all previews section from readme.

baahver commented 1 year ago

It looks like I have the same problem. If I run:
preview:generate-all -vvv I got this error and end of the process:

2023-08-04T09:57:28+00:00 In File.php line 56:
2023-08-04T09:57:28+00:00                                     
2023-08-04T09:57:28+00:00   [OCP\Files\GenericFileException]  
2023-08-04T09:57:28+00:00                                     
2023-08-04T09:57:28+00:00 
2023-08-04T09:57:28+00:00 Exception trace:
2023-08-04T09:57:28+00:00   at /var/www/nextcloud/lib/private/Files/Node/File.php:56
2023-08-04T09:57:28+00:00  OC\Files\Node\File->getContent() at /var/www/nextcloud/lib/private/Files/SimpleFS/SimpleFile.php:74
2023-08-04T09:57:28+00:00  OC\Files\SimpleFS\SimpleFile->getContent() at /var/www/nextcloud/lib/private/Preview/GeneratorHelper.php:73
2023-08-04T09:57:28+00:00  OC\Preview\GeneratorHelper->getImage() at /var/www/nextcloud/lib/private/Preview/Generator.php:213
2023-08-04T09:57:28+00:00  OC\Preview\Generator->generatePreviews() at /var/www/nextcloud/lib/private/PreviewManager.php:212
2023-08-04T09:57:28+00:00  OC\PreviewManager->generatePreviews() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:230
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->parseFile() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:212
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:190
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->generateUserPreviews() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:136
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}() at /var/www/nextcloud/lib/private/User/Manager.php:632
2023-08-04T09:57:28+00:00  OC\User\Manager->callForSeenUsers() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:135
2023-08-04T09:57:28+00:00  OCA\PreviewGenerator\Command\Generate->execute() at /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:298
2023-08-04T09:57:28+00:00  Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:1040
2023-08-04T09:57:28+00:00  Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:301
2023-08-04T09:57:28+00:00  Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:171
2023-08-04T09:57:28+00:00  Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:211
2023-08-04T09:57:28+00:00  OC\Console\Application->run() at /var/www/nextcloud/console.php:100
2023-08-04T09:57:28+00:00  require_once() at /var/www/nextcloud/occ:11
2023-08-04T09:57:28+00:00 
2023-08-04T09:57:28+00:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]

I followed this guide, to install some additional packages (Ubuntu server 22.04)
And Deactivate App, Uninstall App, Install App again and executed: occ files:scan-app-data

But still cannot finisch the preview generation. It always ends in the same directory: In this case: InstantUpload/Camera/2022/03 When I touch .nomedia I can skip this folder, but a little bit later it ends again in another folder. I even tried to fix some file names removing spaces, but that is not a solution. ;(

Can you help to find a real solution?

joeywang4 commented 1 year ago

I guess the cause is that the DB contains some file records that do not actually exist in the file system. If that is true, you can clean up the existing preview files and the records in DB and regenerate all the previews.

  1. Delete existing preview files sudo rm -rf /var/www/nextcloud/data/appdata_[$instanceId]/preview/*
  2. Update the AppData folder in DB
    sudo mysql
    USE nextcloud;
    DELETE FROM oc_filecache WHERE path LIKE "appdata\_[$instanceId]/preview/%";
  3. Regenerate the preview files occ preview:generate-all -vvv

If the problem persists, maybe you can provide the error log generated by nextcloud (located at /var/www/nextcloud/data/nextcloud.log).

baahver commented 1 year ago

Thank you @joeywang4 Would it not been fixed with:

joeywang4 commented 1 year ago

sudo -u www-data php occ files:scan-app-data usually ensures the AppData folder is consistent with the records in DB, but I encountered this problem before and that command didn't seem to work (not sure though).

Still, you should check the nextcloud log to figure out the real cause of your problem.

baahver commented 1 year ago

@joeywang4 Thank you! I've just deleted appdata[$instanceId]/preview/ from data folder, and deleted appdata\[$instanceId]/preview/% in oc-filecache. I "occ files:scan --all" first, and know previews are generated. Fingers crossed. Edit: That worked. Thank you @joeywang4

LarsBel commented 10 months ago

I had the same issue.

DELETE FROM oc_filecache WHERE path LIKE "appdata\_[$instanceId]/preview/%";

did the trick for me also

maxju commented 8 months ago

sudo -u www-data php occ files:scan-app-data usually ensures the AppData folder is consistent with the records in DB, but I encountered this problem before and that command didn't seem to work (not sure though).

Still, you should check the nextcloud log to figure out the real cause of your problem.

This fixed the GenericFileException for me, thanks.

st3iny commented 7 months ago

Rescanning and/or deleting all previews should help.

I'm closing this issue as it seems to be resolved.