ap4y / OrigamiEngine

Lightweight audio engine for iOS and OSX with flac, cue, mp3, m4a, m3u support.
http://ap4y.github.com/OrigamiEngine/
MIT License
545 stars 117 forks source link

"too many files" error after playing a local song during 4 minutes #47

Closed javiergonzper closed 9 years ago

javiergonzper commented 9 years ago

HI @ap4y and @daria-kopaliani

I am having the problem about "too many files" that was spoke before at https://github.com/ap4y/OrigamiEngine/pull/35. In my case the steps to reproduce are: 1- Remove the internet conection of the device or the computer (if I am using the simulator). With internet everything works perfect (it is crazy). 2- Start playing a song of 4 minutes 30 seconds and lock the device. 3- Wait until the song finish. It can not load the next song because "too many files open" (impossible to read any image or access to the SQLite database...).

I have the current version of master.

I added a trace on the delegate of the update of the seconds (but controlling that do it only every 30 seconds) and there I read the NSData of a file. I can read the local file during the 3 or 4 first minutes playing. After that (while the song is playing) I started to receive errors "too many files open".

<0x1815c400 MusicPlayerViewController.m:(1491)> Error: Error Domain=NSCocoaErrorDomain Code=256 
"The operation couldn\U2019t be completed. (NSCocoaErrorDomain error 256.)" 
UserInfo=0x18bd8d70 {NSFilePath=/var/mobile/Containers/Data/Application/3526F4B6-D012-4225-B2FF-FB7031F4FF9D/Documents/Covers/2.png, NSUnderlyingError=0x18be7040 
"The operation couldn\U2019t be completed. (NSPOSIXErrorDomain error 24 - Too many open files)"}

If I added the code of the commit https://github.com/ap4y/OrigamiEngine/commit/8121642b94e5cf5ad0ea6cc2110ed73c3fef12bc I can change from the song playing to the next one but the Sandbox stil blocked and I still can not access to the Database or the image due the error "too many files" so that is not the solution at least for my problem :disappointed:

ap4y commented 9 years ago

This is happening on iOS, right? That's interesting, generic posix error like this usually means that you used all allowed file descriptors. On a unix systems you can usually check it with ulimit(1). I wonder if getrlimit(2) is available on iOS, it will make debugging easier.

I will check scenario that you described and will see what I can do.

javiergonzper commented 9 years ago

Yes, sorry it happens on iOS7 and iOS8. I did not check in older versions but apparently is the same.

Thanks

javiergonzper commented 9 years ago

Hey @ap4y I found my problem. It is not on your library it is on my code. I am reading from the disk on the refreshPlayer to refresh the times and other things.

I'm sorry I wasted your time. Your player is awesome, thanks for your job.

ap4y commented 9 years ago

No worries @javiergonzper and thanks for the kind words.