SkyTubeTeam / SkyTube

Copylefted libre / open source YouTube player for Android
GNU General Public License v3.0
2.29k stars 320 forks source link

fatal crash caused by OutOfMemoryError #711

Open tingsu opened 4 years ago

tingsu commented 4 years ago

The bug was found in the version 2.97 when running on an emulator device with 4GB memory.

I am not sure whether this issue can be triggered on real device with larger memory. But, anyway, I reported it here with the stack trace.

 FATAL EXCEPTION: AsyncTask #1
 Process: free.rm.skytube.extra, PID: 20194
 java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:309)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
 Caused by: java.lang.OutOfMemoryError: Failed to allocate a 1781806 byte allocation with 889704 free bytes and 868KB until OOM
    at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
    at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:125)
    at java.lang.StringBuilder.append(StringBuilder.java:271)
    at free.rm.skytube.businessobjects.YouTube.VideoStream.HttpDownloader.readResponse(HttpDownloader.java:124)
    at free.rm.skytube.businessobjects.YouTube.VideoStream.HttpDownloader.execute(HttpDownloader.java:84)
    at org.schabi.newpipe.extractor.downloader.Downloader.get(Downloader.java:70)
    at org.schabi.newpipe.extractor.downloader.Downloader.get(Downloader.java:42)
    at org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor.loadDecryptionCode(YoutubeStreamExtractor.java:830)
    at org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor.onFetchPage(YoutubeStreamExtractor.java:719)
    at org.schabi.newpipe.extractor.Extractor.fetchPage(Extractor.java:54)
    at free.rm.skytube.businessobjects.YouTube.newpipe.NewPipeService.getDetails(NewPipeService.java:209)
    at free.rm.skytube.businessobjects.YouTube.Tasks.GetVideoDescriptionTask.getDetails(GetVideoDescriptionTask.java:71)
    at free.rm.skytube.businessobjects.YouTube.Tasks.GetVideoDescriptionTask.doInBackground(GetVideoDescriptionTask.java:54)
    at free.rm.skytube.businessobjects.YouTube.Tasks.GetVideoDescriptionTask.doInBackground(GetVideoDescriptionTask.java:36)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    ... 3 more
gzsombor commented 4 years ago

Huhh. Strange and a bit unexpected. I haven't seen out of memory error yet with SkyTube. I regularly debug it in emulator too as well. And my phone / tablet have much less memory than 4 GB. There is not too many thing, what the app tries to hold in memory - if you open a channel with hundreds of videos, and you keep scrolling down, that could force to keep data in. But here, you tried to download a video description, I'm assuming you tried to watch it