nova-video-player / aos-AVP

NOVA opeN sOurce Video plAyer: main repository to build them all
Apache License 2.0
3.36k stars 202 forks source link

[Bug]: App hanging/crashing when browsing Episodes by date #605

Open mschumacher69 opened 2 years ago

mschumacher69 commented 2 years ago

Problem description

I use nova with an SMB server that auto re-scans on every app launch. This used to work flawlessly in the past, but not anymore.

Now, whenever I browse Episodes by date, I cannot play anything unless it finishes a scanning cycle without any changes to the database because it crashes if I visit Episodes by date while it's updating the library. For example if I try to play a file while the database is being updated, it circles, even the file info such as the subtitles and media info would be circling. And if I access the network section during this time, I wouldn't see my indexed folders, even though the SMB itself is there and accessible. And if I keep browsing under Episodes by date while it's refreshing the library, the app crashes to a blue screen and restarts.

Any idea what might be causing this?

Steps to reproduce the issue

  1. Start Nova.
  2. Go to Episodes by date while it's scanning and try to play a file or just browse in there or sit on that view without doing anything.
  3. If you manage to play a file before it crashes, it would circle forever or crash into a blue screen and restart and if you just browse in there or just stay in this view and don't do anything, it would crash into a blue screen and restart.
  4. You wouldn't be able to go to Episodes by date without a crash unless you wait for it to finish scanning and then go to Episodes by date. The successful visit would always have to be after a blank scan that doesn't add/remove anything from the library. So for example, if it scans and adds/removes something from the library, browsing Episodes by date after the scan would crash Nova. Only the next visit after a scan would be successful as long as the last scan didn't add/remove anything from the library.

Expected behavior

You should be able to browse Episodes by date and play files without the app crashing.

Your phone/tablet/androidTV model

Sony Bravia Android TV and Chromecast with Google TV

Operating system version

Android 9 / Android 12

Application version and app store

Latest Version from the Play Store and latest version from GitHub

Additional system information

No response

Debug logs

Not sure how to capture logs on Android TV.

courville commented 2 years ago

Hi, have you been using the v6.0 of nova and then got back to google play release one? It would help if you can get me some logs of the crash. Since I have not touched for a long time the google play release, it could be an external factor. Did you get an update of your TV firmware? This is not something that has been reported before. To capture logs please follow https://github.com/nova-video-player/aos-AVP/wiki/Debugging and do it via the network from a PC. EDIT: anyway I would recommend to move to v6.x of nova that should be release soon and start from a fresh install. If there is a bug it could have been fixed in this release and since this is the only version targeting API31, only this version can be released on Google Play for a bug fix.

mschumacher69 commented 2 years ago

Hey, no I never upgraded to v6 and then downgraded back to v5, I've always been on the latest google play release.

Ok I will wait for v6 to be released on the play store and see if the issue persists after the upgrade.

courville commented 2 years ago

Can you please check that you have not selected always scan SMB shares at application startup (this in network share tiles rescan options). I would really be interested to get debug logs of the crash you are encountering. If you want a quick fix, I would also advise to install v6 before it gets release. It is supposed to be stable now with quite a large user base.

mschumacher69 commented 2 years ago

I do have Always scan SMB shares at application startup enabled and I have enabled it on purpose since I started using Nova over 2 years ago but I only started having this issue recently.

I will try to get you debug logs when I get the chance.

What's the best way to install v6 before release? Is it on fdroid yet or should I just sideload the latest pre-release build from here?

courville commented 2 years ago

It is now on f-droid (fixed it recently) but I would recommend sideloading the latest github one https://github.com/nova-video-player/aos-AVP/releases/tag/v6.0.52 since it comes with another signature (the one from google play).

mschumacher69 commented 2 years ago

Oh perfect, this means I can install both at the same time, right?

courville commented 2 years ago

I do not think so since it has the same package name.

mschumacher69 commented 2 years ago

Oh ok. So if I wanna sideload the latest one from github, I have to uninstall the play store one first?

If that's the case, is there a way to backup everything and restore it after I sideload v6? Because I have a lot of scraped movies and tv shows and it might take a long time to re-scrape them all.

courville commented 2 years ago

It is advised to reinstall from scratch migrating to v6 because of the migration from tvdb to tmdb for series scrape.

mschumacher69 commented 2 years ago

So here's a logcat: logcat.txt

courville commented 2 years ago

Thanks for the logcat, crash is the following:

--------- beginning of crash
04-04 18:46:53.055 23230 23268 E AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
04-04 18:46:53.055 23230 23268 E AndroidRuntime: Process: org.courville.nova, PID: 23230
04-04 18:46:53.055 23230 23268 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.loader.content.ModernAsyncTask$3.done(SourceFile:164)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)
04-04 18:46:53.055 23230 23268 E AndroidRuntime: Caused by: android.database.CursorWindowAllocationException: Cursor window allocation of 2097152 bytes failed. # Open Cursors=507 (# cursors opened by this proc=507)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.database.CursorWindow.<init>(CursorWindow.java:136)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.database.CursorWindow.<init>(CursorWindow.java:114)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:143)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:137)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.database.CursorWrapper.getCount(CursorWrapper.java:60)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.content.ContentResolver.query(ContentResolver.java:822)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at android.content.ContentResolver.query(ContentResolver.java:753)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.core.content.ContentResolverCompat.query(SourceFile:81)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.loader.content.CursorLoader.loadInBackground(SourceFile:63)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.loader.content.CursorLoader.loadInBackground(SourceFile:41)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(SourceFile:307)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(SourceFile:60)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(SourceFile:48)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at androidx.loader.content.ModernAsyncTask$2.call(SourceFile:141)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
04-04 18:46:53.055 23230 23268 E AndroidRuntime:        ... 3 more

Is this with version 6 or 5?

courville commented 2 years ago

Ah I see this one too:

04-04 19:00:20.726  2979  2979 E AndroidRuntime: Process: org.courville.nova, PID: 2979
04-04 19:00:20.726  2979  2979 E AndroidRuntime: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at java.lang.Thread.nativeCreate(Native Method)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at java.lang.Thread.start(Thread.java:733)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at com.archos.mediacenter.utils.trakt.TraktService.onCreate(SourceFile:1218)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3570)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at android.app.ActivityThread.access$1300(ActivityThread.java:200)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:193)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6718)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
04-04 19:00:20.726  2979  2979 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
mschumacher69 commented 2 years ago

Thanks for your response, this is the latest v5 from the play store.

So what's causing this issue and would updating to v6 resolve it?

courville commented 2 years ago

Unfortunately the two stacktraces do not provide details on where it fails in nova code. Anyhow, there will be no other update on v5 on Google Play since it requires to target API30 now and v5 in API29. Let's see if you can see the same issue on v6 the only possible next version on Google Play (it targets API31).

mschumacher69 commented 2 years ago

Okay, I will wait for v6.

mschumacher69 commented 2 years ago

Another user with a similar issue: https://www.reddit.com/r/NovaVideoPlayer/comments/u7xn1h/nvp_and_sony_tvs/

mschumacher69 commented 2 years ago

@courville any eta on the v6 google play release? Or shall I just sideload the github apk? Or shall I use the amazon app store or fdroid?

Which app store do you usually publish the latest version to first?

courville commented 2 years ago

I am solving all the instabilities seen on amazon deployment before going wider scale with Google Play. ETA 2 weeks. I would recommend to sideload github latest v6.

mschumacher69 commented 2 years ago

OK thanks. Is the github apk stable enough? Thing is, Nova is my main media center and I consume a lot of TV shows daily, so I cannot afford to come 1 day and find that it's not working. Like for example when you upgraded ffmpeg to 5.0.1 which broke playback and then had to revert back to 4.4.1, that would have probably cost me 1 day of playback.

So which github apks should I usually update to in order to avoid such issues? Should I avoid ones labelled as pre-release? For example now, the latest github apk is labelled "amazon release" but you just said there are instabilities on amazon deployment, so should I install this v6.0.63 amazon release or another release?

That's why I'd rather stick with an app store release (such as play store, amazon store or fdroid) that would auto update so I don't have to keep manually sideloading apks and wonder which one to sideload and which one to avoid.

courville commented 2 years ago

@mschumacher69 we are talking about store releases since it is published on amazon. By instabilities, I mean existing issues that are also present on v5 Google play store since now I have more actionable information to fix these based on sentry debug backend information collected.

And I am sorry to hear about about your 1 day playback loss.

mschumacher69 commented 2 years ago

Oh no I haven't lost any playback time yet, I'm just trying not to lose any playback time in the future.

Sorry if I might be sounding like an ass, but I don't mean any disrespect here and I appreciate all the work that you do and all the time that you put into developing Nova free of charge, I'm telling you it blows people's minds when they see it on my TV and they all swear that "this is better than Netflix"! So I wouldn't want to invite friends over to movie night to then be surprised that it's not working, which would be disappointing.

So back to sideloading the apk from github, are you saying I must always sideload the store releases and skip the pre-releases and internal/beta releases?

And let's say I sideload the "amazon release" apk today, and tomorrow you release another apk labelled "fdroid release" and then another day you release another apk labelled "google play release", should I update from one release to the other or should I always stick with the same release? In other words, if I sideload an "amazon release", should I only update to newer amazon releases or can I update to an fdroid/google play release?

I'm just confused how to proceed with updates once I sideload the github apk.

courville commented 2 years ago

Process: stick with github released apk for now, when google play will kick in it will update the github one (same signature). Stability issues that I am fixing are not seen for "normal" users. I mentioned f-droid because the github release integrated changes that fixed the f-droid automatic build from source (i.e. it was not per say a specific f-droid release).

mschumacher69 commented 2 years ago

Ok thank you.

mjnewton commented 2 years ago

And I am sorry to hear about about your 1 day playback loss.

:laughing:

mschumacher69 commented 2 years ago

@courville I'm trying to sideload the latest APK from GitHub but it's not installing. My tv is arm64-v8a and I'm sideloading the arm64-v8a APK.

I tried both with solid explorer and file commander. I also tried uninstalling the play store version. PXL_20220429_200821203

courville commented 2 years ago

Are you sure that your tv is arm64? Please try arm32.

mschumacher69 commented 2 years ago

AIDA64 says the following: Instruction Set: 64-bit ARMv8-A (32-bit Mode) Supported ABIs: armeabi-v7a, armeabi Supported 32-bi ABIs: armeabi-v7a, armeabi

Does this mean I need to install Video-armeabi-v7a-API_21+-release.apk?

Anyway, I sideloaded f-droid and installed it from there. Is that ok or should I uninstall the f-droid version and sideload the github apk?

courville commented 2 years ago

Yes take the github armeabi-v7a one.

mschumacher69 commented 2 years ago

Why not stay on the f-droid build? It would be easier to update through f-droid rather than having to sideload manually from github every time there's a new version.

courville commented 2 years ago

F-droid is fine but APK is signed by them built from source which is not compatible with my own signature and Google play one.

mschumacher69 commented 2 years ago

Ok. I will probably not go back to google play because you said it doesn't have adult scraping.

If I install the github apk and then update to the google play version, I would lose adult scraping, right?

courville commented 2 years ago

Github release has adult scraping.

mschumacher69 commented 2 years ago

Right, but you said the play store release will overwrite the github release once updated. So if I install the github release and then it updates through the play store, I would lose adult scraping, right?

mschumacher69 commented 2 years ago

So it still crashes from time to time on v6.0.63 (latest f-droid version). It doesn't crash mid playback, it usually crashes while I'm browsing to select what I'm gonna play.

Here's a logcat: logcat1.txt

courville commented 2 years ago

OK thanks for sharing the logcat, what I see is that the crash is due to OOM:

05-09 19:34:47.413 13257 13302 F libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 13302 (RenderThread), pid 13257 (.courville.nova)
05-09 19:34:47.765 14773 14773 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-09 19:34:47.765 14773 14773 F DEBUG   : Build fingerprint: 'Sony/BRAVIA_ATV3_4K_PA/BRAVIA_ATV3_4K:9/PTT1.190515.001.S43/671651:user/release-keys'
05-09 19:34:47.765 14773 14773 F DEBUG   : Revision: '0'
05-09 19:34:47.765 14773 14773 F DEBUG   : ABI: 'arm'
05-09 19:34:47.765 14773 14773 F DEBUG   : pid: 13257, tid: 13302, name: RenderThread  >>> org.courville.nova <<<
05-09 19:34:47.765 14773 14773 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
05-09 19:34:47.765 14773 14773 F DEBUG   : Abort message: 'Encountered EGL error 12291 EGL_BAD_ALLOC during rendering'
05-09 19:34:47.766 14773 14773 F DEBUG   :     r0  00000000  r1  000033f6  r2  00000006  r3  b28e4700
05-09 19:34:47.766 14773 14773 F DEBUG   :     r4  000033c9  r5  000033f6  r6  912632dc  r7  0000010c
05-09 19:34:47.766 14773 14773 F DEBUG   :     r8  91263797  r9  00000001  r10 00000001  r11 00000000
05-09 19:34:47.766 14773 14773 F DEBUG   :     ip  00000041  sp  912632c8  lr  b28700ad  pc  b2867e3a
05-09 19:34:47.882 13257 13300 E AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
05-09 19:34:47.882 13257 13300 E AndroidRuntime: Process: org.courville.nova, PID: 13257
05-09 19:34:47.882 13257 13300 E AndroidRuntime: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
05-09 19:34:47.882 13257 13300 E AndroidRuntime:        at java.lang.Thread.nativeCreate(Native Method)
05-09 19:34:47.882 13257 13300 E AndroidRuntime:        at java.lang.Thread.start(Thread.java:733)
05-09 19:34:47.882 13257 13300 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:975)
05-09 19:34:47.882 13257 13300 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:1043)
05-09 19:34:47.882 13257 13300 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1185)
05-09 19:34:47.882 13257 13300 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-09 19:34:47.882 13257 13300 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)
05-09 19:34:47.966 14773 14773 F DEBUG   :
05-09 19:34:47.966 14773 14773 F DEBUG   : backtrace:
05-09 19:34:47.966 14773 14773 F DEBUG   :     #00 pc 0001ce3a  /system/lib/libc.so (abort+62)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #01 pc 00006dd5  /system/lib/liblog.so (__android_log_assert+156)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #02 pc 00378605  /system/lib/libhwui.so (android::uirenderer::renderthread::EglManager::swapBuffers(android::uirenderer::renderthread::Frame const&, SkRect const&)+268)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #03 pc 00374231  /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::swapBuffers(android::uirenderer::renderthread::Frame const&, bool, SkRect const&, android::uirenderer::FrameInfo*, bool*)+48)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #04 pc 0009ae0f  /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+270)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #05 pc 00377a1b  /system/lib/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+942)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #06 pc 0033f00f  /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+122)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #07 pc 000a3ccb  /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+178)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #08 pc 0000c197  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+166)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #09 pc 00063bb5  /system/lib/libc.so (__pthread_start(void*)+22)
05-09 19:34:47.966 14773 14773 F DEBUG   :     #10 pc 0001e02d  /system/lib/libc.so (__start_thread+22)

Now the question is why do we come to this memory consumption...

mschumacher69 commented 2 years ago

Could it be because I have a lot of shows and movies in the library? How can we troubleshoot this further?

courville commented 2 years ago

I do not think it is related to the number of shows or movies in the library. I will try to think of some extra logging to add in order to troubleshoot this issue. Can you please tell me more about the exact browsing actions that lead to this behavior? Is this on a specific tile?

mschumacher69 commented 2 years ago

Ok thanks. I usually browse Episodes by date and Movies by year and this is where it mostly happens, but I will try to monitor closely to see if this is random or only happens on that screen or when I do a certain action.

mschumacher69 commented 2 years ago

Ok so I did some further testing today and I think it always happens while browsing under Episodes by date. Also, something strange happened today where instead of crashing, it just started showing gibberish text.

Here's another logcat: logcat2.txt

I tried uploading a video but it seems to be too large, so here are some screenshots: PXL_20220510_194908459 TS_exported_41505_1652214369213 PXL_20220510_194908459 TS_exported_34436_1652214358497 PXL_20220510_194908459 TS_exported_20902_1652214326831 PXL_20220510_194908459 TS_exported_17001_1652214319420 PXL_20220510_194908459 TS_exported_12701_1652214312435 PXL_20220510_194908459 TS_exported_3133_1652214295890 PXL_20220510_194642104

mschumacher69 commented 2 years ago

From my recent observations, I think this is mostly happening when I'm browsing Episodes by date.

mschumacher69 commented 2 years ago

So yeah I think I'm only experiencing this when browsing Episodes by date.

Any idea how to troubleshoot this further?

Pentaphon commented 2 years ago

So yeah I think I'm only experiencing this when browsing Episodes by date.

Any idea how to troubleshoot this further?

I'm surprised the new logger isn't capturing your crash by now. I also get a crash when doing my initial scan on v6 and just browsing around the UI while it scans but I'm not sure it's related to your crash.

mschumacher69 commented 2 years ago

Is there a new logger? How do I use it to capture the crash?

Pentaphon commented 2 years ago

Is there a new logger? How do I use it to capture the crash?

I believe they added Sentry to capture data to start going after crash bugs so there's nothing you have to do but I'm surprised this issue hasn't been resolved for you.

mschumacher69 commented 2 years ago

@courville is there anything I can do to help you troubleshoot this further?

mschumacher69 commented 2 years ago

I'm using Nova on Google TV now and this still happens. It doesn't happen as often as on my Sony TV, but it still happens occasionally.

So the issue doesn't only affect Sony TVs.

mschumacher69 commented 2 years ago

@courville I now know exactly when this happens, it happens when I browse episodes by date while the app is re-scanning. I have auto-rescan when opening the application enabled, so this happens every time I open the app and also after Ambient Mode, the app seems to interpret exiting ambient mode as opening the app so it re-scans every time I exit Ambient Mode when the Ambient Mode comes on top of the app.

mschumacher69 commented 1 year ago

@courville any chance of fixing this?

mschumacher69 commented 1 year ago

Hey @courville, any luck replicating this?

courville commented 1 year ago

@mschumacher69 could you please replicate the issue while using the 6.0.80 github version? I might get crash traces on sentry crashnalytics backend and see where it happens. I get traces only with github releases.