nextcloud / previewgenerator

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

generate-all UID fails where generate-all --path=PATH succeeds #377

Closed langfingaz closed 3 months ago

langfingaz commented 1 year ago

Summary

When I run generate-all for a Nextcloud user, it fails while processing a folder. Running generate-all just for that folder succeeds.

Details

I ran preview:generate-all Eowyn twice. Each time it failed with an error during processing the recipe folder:

2023-04-12T08:43:51+00:00 Scanning folder /Eowyn/files/Rezepte/Rezepte_***
An unhandled exception has been thrown:
TypeError: chr(): Argument #1 ($codepoint) must be of type int, string given in /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/Tags/getid3_id3v2.php:3328
Stack trace:
#0 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/Tags/getid3_id3v2.php(3328): chr('\x00')
#1 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/Tags/getid3_id3v2.php(3345): ID3Parser\getID3\Tags\getid3_id3v2::IsANumber('\x00Bayeris', false)
#2 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/Tags/getid3_id3v2.php(1660): ID3Parser\getID3\Tags\getid3_id3v2::IsValidDateStampString('\x00Bayeris')
#3 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/Tags/getid3_id3v2.php(338): ID3Parser\getID3\Tags\getid3_id3v2->ParseID3v2Frame(Array)
#4 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/getid3.php(164): ID3Parser\getID3\Tags\getid3_id3v2->Analyze()
#5 /var/www/html/3rdparty/christophwurst/id3parser/src/ID3Parser.php(20): ID3Parser\getID3\getid3->analyze('/var/www/html/d...')
#6 /var/www/html/lib/private/Preview/MP3.php(51): ID3Parser\ID3Parser->analyze('/var/www/html/d...')
#7 /var/www/html/lib/private/Preview/GeneratorHelper.php(65): OC\Preview\MP3->getThumbnail(Object(OC\Files\Node\File), 512, 512)
#8 /var/www/html/lib/private/Preview/Generator.php(343): OC\Preview\GeneratorHelper->getThumbnail(Object(OC\Preview\MP3), Object(OC\Files\Node\File), 512, 512)
#9 /var/www/html/lib/private/Preview/Generator.php(162): OC\Preview\Generator->getMaxPreview(Object(OC\Files\SimpleFS\SimpleFolder), Object(OC\Files\Node\File), 'audio/mpeg', '')
#10 /var/www/html/lib/private/PreviewManager.php(200): OC\Preview\Generator->generatePreviews(Object(OC\Files\Node\File), Array, 'audio/mpeg')
#11 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(230): OC\PreviewManager->generatePreviews(Object(OC\Files\Node\File), Array)
#12 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(212): OCA\PreviewGenerator\Command\Generate->parseFile(Object(OC\Files\Node\File))
#13 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(190): OCA\PreviewGenerator\Command\Generate->parseFolder(Object(OC\Files\Node\Folder), Array)
#14 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(142): OCA\PreviewGenerator\Command\Generate->generateUserPreviews(Object(OC\User\User))
#15 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\PreviewGenerator\Command\Generate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Compon
ent\Console\Output\ConsoleOutput))
#16 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component
\Console\Output\ConsoleOutput))
#17 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\PreviewGenerator\Command\Generate), Object(Symfony\Component
\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Co
nsole\Output\ConsoleOutput))
#19 /var/www/html/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/console.php(100): OC\Console\Application->run()
#21 /var/www/html/occ(11): require_once('/var/www/html/c...')
#22 {main}

There is no error message in my Nextcloud log.

If I understand the code correctly, generate-all iterates over all folders sequentially and does first print the name of a folder before starting to open and process image/video files in that folder.

So I tried to produce the same error by directly specifying the folder. But this succeeds:

preview:generate-all --path=/Eowyn/files/Rezepte/Rezepte_***
2023-04-12T08:54:13+00:00 Scanning folder /Eowyn/files/Rezepte/Rezepte_***

More detailed logs

At the moment I'm running the preview generation again with increased verbosity and will add this here later on.

langfingaz commented 1 year ago

This error does probably come from christophwurst/id3parser. So I followed the suggestion of the repository owner

It might be worth checking https://github.com/nextcloud/server for earlier reports. This repo isn't actively maintained.

and created an issue at https://github.com/nextcloud/server/issues/37688 with further details on the problematic file.

Independently of fixing the error in reading MP3 or image tags, we should still consider whether it makes sense to catch errors when processing a media file so that the preview generation does not abort but all other files continue to be processed.

joshtrichards commented 3 months ago

Fixed in nextcloud/server#38496

Independently of fixing the error in reading MP3 or image tags, we should still consider whether it makes sense to catch errors when processing a media file so that the preview generation does not abort but all other files continue to be processed.

Agreed. Tracking that in #142