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

Crash when scanning #921

Closed
erwdavid opened this issue Nov 19, 2021 · 7 comments
Closed

Crash when scanning #921

erwdavid opened this issue Nov 19, 2021 · 7 comments
Labels

Comments

@erwdavid
Copy link

After installed I made the app scan my music, it stopped mid way.
Using the CLI scan command I got:

root@nextcloud:/usr/local/nextcloud # sudo -u www ./occ music:scan erwan --debug
Start scan for erwan
Found 3721 music files to scan
An unhandled exception has been thrown:
DivisionByZeroError: Division by zero in /usr/local/nextcloud/apps/music/3rdparty/getID3/getid3/module.audio.mpc.php:404
Stack trace:
#0 /usr/local/nextcloud/apps/music/3rdparty/getID3/getid3/module.audio.mpc.php(54): getid3_mpc->ParseMPCsv6()
#1 /usr/local/nextcloud/apps/music/3rdparty/getID3/getid3/getid3.php(778): getid3_mpc->Analyze()
#2 /usr/local/nextcloud/apps/music/lib/Utility/ExtractorGetID3.php(75): getID3->analyze('/erwan/files/Mu...', 7086915, '', Resource id #1384)
#3 /usr/local/nextcloud/apps/music/lib/Utility/Scanner.php(171): OCA\Music\Utility\ExtractorGetID3->extract(Object(OC\Files\Node\File))
#4 /usr/local/nextcloud/apps/music/lib/Utility/Scanner.php(119): OCA\Music\Utility\Scanner->extractMetadata(Object(OC\Files\Node\File), Object(OC\Files\Node\Folder), '/erwan/files/Mu...')
#5 /usr/local/nextcloud/apps/music/lib/Utility/Scanner.php(480): OCA\Music\Utility\Scanner->updateAudio(Object(OC\Files\Node\File), 'erwan', Object(OC\Files\Node\Folder), '/erwan/files/Mu...', 'audio/mpeg', true)
#6 /usr/local/nextcloud/apps/music/lib/Command/Scan.php(117): OCA\Music\Utility\Scanner->scanFiles('erwan', Object(OC\Files\Node\Folder), Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /usr/local/nextcloud/apps/music/lib/Command/Scan.php(91): OCA\Music\Command\Scan->scanUser('erwan', Object(Symfony\Component\Console\Output\ConsoleOutput), false, false, NULL, true)
#8 /usr/local/nextcloud/apps/music/lib/Command/BaseCommand.php(63): OCA\Music\Command\Scan->doExecute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), Array)
#9 /usr/local/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Music\Command\BaseCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /usr/local/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /usr/local/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Music\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /usr/local/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /usr/local/nextcloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /usr/local/nextcloud/console.php(99): OC\Console\Application->run()
#15 /usr/local/nextcloud/occ(11): require_once('/usr/local/next...')
#16 {main}Segmentation fault

And only half of my music is scanned.

@paulijar
Copy link
Collaborator

Thanks for the report. Something unexpected now happens within the getID3 library when analyzing one of your files. To find out which file this is, you should run occ music:scan without giving the --debug option. In this case, the path of the file to be analyzed is printed before it's actually analyzed. When the --debug is used, the path is printed after the analysis because the purpose of the whole mode is to print some memory usage details related to handling of each file.

After finding the culprit file, could you check if there is anything special with that file? Maybe the file is broken or has weird access rights. Also, one interesting piece of information is whether this file resides on some external storage or in the internal storage of Nextcloud.

@paulijar
Copy link
Collaborator

Also, if you can share the culprit file with me, then I can take a look. With a sample file, I can then report this onward for the getID3 library if necessary. You can find my email address from my github profile.

@erwdavid
Copy link
Author

Thanks, Now I know which file is the culprit. It is a standard mp3 file, access rights are OK

-rw-r--r--  1 www  www  7086915 May 21  2019 /data/erwan/files/Musique-Erwan/principal/Les Quatre Barbus/Les Quatre Barbus - CD 3/La pince a linge (Les Quatre Barbus) version longue.mp3

On local storage, like the other music files.
I'll share it and send you the link.

eye3D gives a warning on this file :

eyeD3 La\ pince\ a\ linge\ \(Les\ Quatre\ Barbus\)\ version\ longue.mp3 
eyed3.mp3.headers:WARNING: Lame tag CRC check failed
/home/edavid/CDs/principal/Les Quatre Barbus/Les Quatre Barbus - CD 3/La pince a linge (Les Quatre Barbus) version longue.mp3                                                                                        [ 6.76 MB ]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 04:55     MPEG1, Layer III        [ 192 kb/s @ 44100 Hz - Joint stereo ]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID3 v2.3:
title: La_pince_a_linge-Les_quatre_barbus
artist: Divers
album: Anthologie de la chanson francaise enregistree 1950
track: 11               genre: Oldies (id 11)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@paulijar
Copy link
Collaborator

Thanks, I got the file. In my test environment using PHP 7.x, I don't see a crash but a warning about "Division by zero" is logged. You are probably using PHP 8 where many of the previously non-fatal errors are being treated more strictly.

But clearly, the getID3 library is not making enough sanity checks here on the input file as it tries to divide by zero. I have reported the issue for the library. James maintaining the library is usually very quick to fix clear bugs like this when a sample file has been provided.

@erwdavid
Copy link
Author

Thanks, I run nextcloud on php 8.0 that's true. I'll wait for another version, meanwhile I'll keep a copy of the file (for testing), and edit ID3 tags to try to make them more correct..

@paulijar
Copy link
Collaborator

James was as fast as always, and already created a patch for this issue at JamesHeinrich/getID3#352. The updated library will be included in the next Music app release. I try to make it next weekend but no promises.

@paulijar paulijar added the Bug label Nov 21, 2021
@paulijar
Copy link
Collaborator

The update getID3 library is now released as part of Music v1.5.0 and this problem should be fixed.

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

No branches or pull requests

2 participants