TeamNewPipe / NewPipe

A libre lightweight streaming front-end for Android.
https://newpipe.net
GNU General Public License v3.0
31.01k stars 3.02k forks source link

Out of memory crash after leaving a player element open for a long time #9882

Open ChaosNicro opened 1 year ago

ChaosNicro commented 1 year ago

Checklist

Affected version

0.25.0

Steps to reproduce the bug

Open a long video ~ 5 hours and leave the player running. Crash occurs after a random amount of time. Above 3 hours from my experience. This happened multiple times and showed this stacktrace.

Expected behavior

Not crashing Not sure what else to put.

Actual behavior

Crashing Video can be restarted from history, but may not resume from the correct position

Screenshots/Screen recordings

No response

Logs

crash occurred several times with the same error watching archived streams ~5 hour videos. It may be related to a players lifetime being too long and thus slowly leaking memory.

Exception

java.lang.OutOfMemoryError: Failed to allocate a 16 byte allocation with 9800 free bytes and 9800B until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
    at java.lang.Long.valueOf(Long.java:845)
    at org.schabi.newpipe.database.history.dao.StreamHistoryDAO_Impl$9.call(StreamHistoryDAO_Impl.java:644)
    at org.schabi.newpipe.database.history.dao.StreamHistoryDAO_Impl$9.call(StreamHistoryDAO_Impl.java:612)
    at io.reactivex.rxjava3.internal.operators.maybe.MaybeFromCallable.subscribeActual(MaybeFromCallable.java:47)
    at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5375)
    at io.reactivex.rxjava3.internal.operators.flowable.FlowableFlatMapMaybe$FlatMapMaybeSubscriber.onNext(FlowableFlatMapMaybe.java:131)
    at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync(FlowableObserveOn.java:404)
    at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:178)
    at io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:324)
    at io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler$ExecutorWorker.runEager(ExecutorScheduler.java:289)
    at io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:250)
    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:920)


Affected Android/Custom ROM version

Leos 19.1 based on LineageOS 19.1 based on Android 12.1

Affected device model

Xiaomi Mi 11 lite 5G (Renoir)

Additional information

No response

av01d1ngx4 commented 1 year ago

This error message indicates that the program has reached its memory limit and is unable to allocate additional memory for a certain task.

According to the stack trace, the issue occurred when attempting to allocate 16 bytes of memory in the Long.valueOf() function, which is called from the StreamHistoryDAO Impl.java file. This can happen if the program tries to create too many objects or store too much data in memory and the heap space available is inadequate.