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
Memory allocation error when scanning large music folder #212
Comments
@pienk Hi. Did you use the latest version? Because I included an incremental scanner (50 steps at once) to avoid such issues. Thanks for your feedback and sorry for the anwsering delay. |
I can confirm this bug report, it happens for me as well. It was scanning happily until song 5253/6766. Even increasing the memory limit to 1536M did not solve it, still a memory exhaustion error. cat apps/music/appinfo/version |
This is happening to me too on 0.1.9.1-rc There are many messages like this one in the log:
I have many FLAC files in my library, it got stuck on 138/1520 and they're on an local external share/mount |
I changed the size of the scan interval from 50 to 20 files on each scan cycle and hope this is enough to fix this issue. (it is included into v0.2 if you download it from the app store or download it from the github release packe - i patched the tar.gz there) |
Still not working for me... on foreach ($music as $file) {
if(!$batch && $count >= 20) {
// break scan - 20 files are already scanned
break;
}
if(!$batch && in_array($file['fileid'], $fileIds)) {
// skip this file as it's already scanned
continue;
}
$this->api->log('resscan: count '.$count ,'debug');
$this->update($file['path'], $userId);
$count++;
} and i got this in owncloud.log {"app":"music","message":"Rescan triggered","level":1,"time":"2014-04-30T18:22:16+00:00"}
{"app":"music","message":"resscan: count 0","level":0,"time":"2014-04-30T18:22:16+00:00"}
{"app":"music","message":"update - file.flac","level":0,"time":"2014-04-30T18:22:16+00:00"}
{"app":"music","message":"update - mimetype audio\/flac","level":0,"time":"2014-04-30T18:22:16+00:00"}
{"app":"PHP","message":"Allowed memory size of 134217728 bytes exhausted (tried to allocate 1167823392 bytes) at \/path_to_owncloud\/apps\/music\/3rdparty\/getID3\/getid3\/getid3.php#1641","level":3,"time":"2014-04-30T18:22:16+00:00"} So maybe it's a problem with the file I'm scanning? I do not know, but it always fails in the same file. |
@naringas I will look for a bigger flac file and test against. Your allowed memory is 128 MB, right? |
@MorrisJobke indeed
|
I have a file here, which causes a memory limit exception:
It fails while reading the file through the music/utility/extractorgetid3.php Line 48 in 9a2ca55
Line 100 in 9a2ca55
I use the latest master of getID3 in music app and tested against a plain getID3 (there is a demo browser and I located the flac file into the tree and it opens up correctly parsed) Steps to reproduce
The weird thing of this is, that it works with so many other files (flac, mp3 ogg) which are even bigger than this one. Comment by @Glandos: I can add that the FLAC (which I ripped) was extracted from the same CD, using the same software. Other tracks are parsed correctly, but not this particular one. |
I debugged a bit and found that there is a nearly endless for loop because the count is mis-calculated. https://github.com/owncloud/music/blob/master/3rdparty/getID3/getid3/module.audio.ogg.php#L506 The variable I changed the loop condition to
and I get following error message from getID3: This is maybe of interest for @JamesHeinrich ;) |
I have included a similar fix in JamesHeinrich/getID3@a9443d5 |
@JamesHeinrich Thanks. I included your fix into 1ec2bce |
@MorrisJobke thanks for the sample file. But I see nothing wrong with it as far as getID3 is concerned. The loop-breaking code is nowhere near to being invoked: $CommentsCount for that file is 13. |
@JamesHeinrich Could this be caused maybe by a misalignment of the retrieved bytes through the stream? Are stream wrappers supported by your library (registered through http://www.php.net/manual/en/function.stream-wrapper-register.php ) Following are registered and used within ownCloud:
@icewind1991 As you know more about the file accessing. The problem is following: There is a file in your ownCloud and as it got accessed through the |
@MorrisJobke can you send me the file again |
Forgive me if that should be a completely unfitting comment, but in my understanding, a sequential scanning of files should not exhaust memory, unless there are some memory leaks during the process. So I would see this incremental scanning rather as a workaround than as a fix (although as one which seems required anyway for being able to output the progress of the scan). But I would still be worried about the memory leaks... |
@RandolfCarter You're right. this needs to be debugged. |
@JamesHeinrich @MorrisJobke getid3 uses ftell to get the current position of the file pointer. Despite all sanity, that is considered a bug: https://bugs.php.net/bug.php?id=30157
As a result the Hm ... strange, somehow ftell returns 8775 bytes after reading the Ping me if you need the flac file. |
@icewind1991 With plain getID3 (no stream wrappers) the same file parses just fine. |
Awesome. It seems that @butonic found a fix for this: owncloud/core#11204 ... I will test this tomorrow. |
A fix will be available in ownCloud 7.0.3 |
When scanning my music collection of 7416 songs the music app stops at 1336 songs imported with the following error in the apache log:
This is an allocation of 3.44 GB and I have an allowed memory size of 512 MB.
There is no music shown in the music app.
After the error there are 1336 rows in my oc_music_tracks table.
If I go to my files app and back to music the app tries to import some (22) more songs but the same error occurs.
My music folder is mounted via the external storage app as local storage.
If I symlink the music folder in my owncloud directory the music does appear in the music app but it stops at around the same point (1350 songs). I am able to play the songs that are imported.
The text was updated successfully, but these errors were encountered: