nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.32k stars 1.78k forks source link

Crash while streaming video #9428

Closed christian-eriksson closed 1 year ago

christian-eriksson commented 2 years ago

Not sure how much detail I can give on this. I was attempting to stream a large video (1080p60hz, recorded on the phone, about 4.7GB). I had clicked into the video in the app, paused the auto play and chosen "stream with". I chose the Samsung video player but didn't get an image. When I tried to go back to the NextCloud app (three horizontal lines to switch app) it crashed with an java.lang.OutOfMemoryError, see below. I tried twice with the same result.

# CAUSE OF ERROR
java.lang.OutOfMemoryError: Failed to allocate a 5688 byte allocation with 141120 free bytes and 137KB until OOM, target footprint 268435456, growth limit 268435456; failed due to fragmentation (largest possible contiguous allocation 1048576 bytes)
    at java.util.Arrays.copyOf(Arrays.java:3257)
    at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:596)
    at java.lang.StringBuffer.append(StringBuffer.java:367)
    at java.io.StringWriter.write(StringWriter.java:94)
    at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:382)
    at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:412)
    at android.util.Log.getStackTraceString(Log.java:494)
    at com.google.android.exoplayer2.util.Log.getThrowableString(Log.java:162)
    at com.google.android.exoplayer2.util.Log.appendThrowableString(Log.java:168)
    at com.google.android.exoplayer2.util.Log.e(Log.java:132)
    at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:437)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:923)
# APP INFORMATION
ID: com.nextcloud.client
Version: 30180090
Build flavor: gplay

# DEVICE INFORMATION
Brand: samsung
Device: beyond1
Model: SM-G973F
Id: RP1A.200720.012
Product: beyond1lteeea

# FIRMWARE
SDK: 30
Release: 11
Incremental: G973FXXSEFUJ2
ezaquarii commented 2 years ago

@AlvaroBrey

I think that this stack trace is a red herring.

Here is where it blows up:

        // This can occur if a stream is malformed in a way that causes an extractor to think it
        // needs to allocate a large amount of memory. We don't want the process to die in this
        // case, but we do want the playback to fail.
        if (!released) {
          Log.e(TAG, "OutOfMemory error loading stream", e);    <--- BLOWS UP HERE 
          obtainMessage(MSG_IO_EXCEPTION, new UnexpectedLoaderException(e)).sendToTarget();
        }

I suspect that the player decoder exhausts the memory and fails with OOM. However, because it's under OOM condition, it does not have enough memory to format stack trace and fails again, with another OOM.

This bug should be fixed upstream.

joshtrichards commented 1 year ago

Hi @christian-eriksson - Thanks for your report. The player has been updated a number of times since your original report. It's possible this issue has been resolved. Though it's hard to say with certainty due to the odd stack trace. Can you retest from your end with a current client version (preferably v3.26.0)?

github-actions[bot] commented 1 year ago

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!