Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phone restarts when opening a video #5961

Closed
4 tasks done
Nista11 opened this issue Mar 30, 2021 · 67 comments
Closed
4 tasks done

Phone restarts when opening a video #5961

Nista11 opened this issue Mar 30, 2021 · 67 comments
Labels
bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software

Comments

@Nista11
Copy link
Contributor

Nista11 commented Mar 30, 2021

Checklist

Steps to reproduce the bug

Press on a video to open it

Actual behaviour

Phone suddenly restarts itself, but it doesn't happen always, seems to be at random times. After it restarts, the phone appears to be lagging a bit until I close the app. Last time it happened the restart screen froze. This bug only started happening after the last update.

Device info

  • Android version/Custom ROM version: Android 11 (MIUI 12.1.4)
  • Device model: Xiaomi Mi 10 Lite 5G
@Nista11 Nista11 added the bug Issue is related to a bug label Mar 30, 2021
@AudricV
Copy link
Member

AudricV commented Mar 31, 2021

What do you want to say by restart?
Do you got the lockscreen after a black screen for a few seconds or your device start animation, with MIUI logo?

@Nista11
Copy link
Contributor Author

Nista11 commented Mar 31, 2021

The start animation

@Nista11
Copy link
Contributor Author

Nista11 commented Mar 31, 2021

New.video.mp4

@AudricV
Copy link
Member

AudricV commented Mar 31, 2021

Thank you for screencast.
So it is a framework crash. Can you try this APK please: https://github.com/TeamNewPipe/NewPipe/suites/2386871925/artifacts/50699858 and see if it works without any crash? Thanks!

@Nista11
Copy link
Contributor Author

Nista11 commented Mar 31, 2021

I tried it a while and it worked, didn't crash

@Nista11
Copy link
Contributor Author

Nista11 commented Mar 31, 2021

Update: after I imported the database from the normal version, it crashed again, so maybe it has something to do with a certain setting?

@AudricV
Copy link
Member

AudricV commented Mar 31, 2021

Can your clear the app data of the debug app, import again the database but without the settings, and let us know if it's reproducible again?
If it works without any issue, can you try again after applying the same settings as the normal app in the settings of the debug app? Thanks!

@Nista11
Copy link
Contributor Author

Nista11 commented Mar 31, 2021

I actually just tried this, and found out that the problem is watch history. When it is disabled, the crash happens, and when it is enabled, it doesn't (same on both the original apk and the one you sent me).

@AudricV
Copy link
Member

AudricV commented Mar 31, 2021

@Goth11 Thanks for your researches.
Can you try this APK https://github.com/TeamNewPipe/NewPipe/suites/2390804303/artifacts/50805040 and repeat my steps above? A crash in the watch history just got fixed with #5971, maybe it's related. Thanks again!

@Nista11
Copy link
Contributor Author

Nista11 commented Mar 31, 2021

It crashes as well.
Like I said, it didn't have this problem until the last update, so maybe there is some change in the last update regarding watch history that is the problem?

@AudricV
Copy link
Member

AudricV commented Mar 31, 2021

Yes, there were some changes. We are investigating.

@AudricV
Copy link
Member

AudricV commented Mar 31, 2021

@Goth11 Can you help us again by trying to get logs from your system with ADB?
Then try to search for exceptions in the logs you got and post on this issue these exceptions. However, you may be not able to find any exception related to this issue because it's a crash from the Android Framework, not an app.
Thank you again for your researches.

@Nista11
Copy link
Contributor Author

Nista11 commented Apr 1, 2021

Crash logs:
https://pastebin.com/nHHkVQLj

@TobiGr
Copy link
Member

TobiGr commented Apr 1, 2021

@Goth11 Thank you for getting the log. Which NewPipe version did you use before?
I could not find anything related to history in the logs, but some note about creating the audio session and gaining audio focus. I do not understand all parts of the log. Maybe @Redirion can help us to understand what was going wrong.

@Redirion
Copy link
Member

Redirion commented Apr 1, 2021

okay, I think I found the issue. It crashes here:
https://github.com/google/ExoPlayer/blob/d640cedab8052b0df86a2adc71850994be7a8e69/library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseHelper.java#L389

ExoPlayer 2.12. Changelog:
"* Pass frame rate hint to Surface.setFrameRate on Android 11."

@Redirion Redirion added device/software specific Issues that only happen on some devices or with some specific hardware/software and removed more info needed labels Apr 1, 2021
@Redirion
Copy link
Member

Redirion commented Apr 1, 2021

@avently can you take a look at the video? It might be some kind of racing issue. The video buffering is not done, then it gets moved down for playback in background and the next video is clicked. setFrameRate seems to be called while the first video view gets destroyed/recycled to play the next video.

Chances are that this can be fixed within NewPipe if we can add a small delay somewhere but otherwise this seems to be either an ExoPlayer or device issue.

@Nista11
Copy link
Contributor Author

Nista11 commented Apr 1, 2021

@Goth11 Thank you for getting the log. Which NewPipe version did you use before?
I could not find anything related to history in the logs, but some note about creating the audio session and gaining audio focus. I do not understand all parts of the log. Maybe @Redirion can help us to understand what was going wrong.

The last version I used was 20.9 but I'm using NewPipe for some months now and always updated it so I used older versions as well and none had this bug.

@Nista11
Copy link
Contributor Author

Nista11 commented Apr 1, 2021

@avently can you take a look at the video? It might be some kind of racing issue. The video buffering is not done, then it gets moved down for playback in background and the next video is clicked. setFrameRate seems to be called while the first video view gets destroyed/recycled to play the next video.

Chances are that this can be fixed within NewPipe if we can add a small delay somewhere but otherwise this seems to be either an ExoPlayer or device issue.

But why does the crash only happen when watch history is disabled, and when it is enabled it doesn't? I don't see the connection.

@Nista11
Copy link
Contributor Author

Nista11 commented Apr 1, 2021

Ok so I just found out that the crash happens if watch history is disabled AND I go from a video to another one. That is, if I play a video, close it, and play another, it's fine, but if I keep it in background and play another one or I choose one from the watch next tab, it crashes (only with watch history disabled!)

@avently
Copy link
Contributor

avently commented Apr 1, 2021

@Redirion no time, sorry. Rewriting a big part of my app. If it's related to ExoPlayer's update just create an issue and link the guys who made this change. Maybe they'll give some important insights

@avently
Copy link
Contributor

avently commented Apr 1, 2021

@Goth11 in all such cases a screen record will be the most useful thing. Can you make it and upload? Without the very last step that crashes the phone

@avently
Copy link
Contributor

avently commented Apr 1, 2021

@Goth11 the link is not publicly available

@Nista11
Copy link
Contributor Author

Nista11 commented Apr 1, 2021

Sorry, it should be now.

@avently
Copy link
Contributor

avently commented Apr 1, 2021

Oh, man. You have already uploaded a video with the issue. My github client doesn't show such videos at all so I missed it. Ok. Based on the first video I can't say that it can be NewPipe bug.

@Nista11
Copy link
Contributor Author

Nista11 commented Apr 1, 2021

Yes but on the second video you can see that the crash is connected to a certain NewPipe setting.

@litetex
Copy link
Member

litetex commented Aug 25, 2021

@TobiGr
Any progress on this?

My personal statement to this:
It's not our responsibility as it happens on OS level.
If the app crashes - that's okay as it can happen. But if the whole OS crashes?
The manufacturer is responsible for his OS - so if he is unable to implement Android OS properly he should also fix it.
Otherwise we can launch NewPipe OS soon 😆

In the mean time: Try updating the underlying OS.

Maybe also updating ExoPlayer could help or reporting the problem there (don't know if it happened as mentioned in #6076 (comment)?


@KatoriYuu
Nokia released at least 2 patches since Nokia/Phoenix_00WW/PNX_sprout:11/RKQ1.200906.002/00WW_6_210:

Did those fix the problem?

@KatoriYuu
Copy link

@litetex My phone has received the latest possible update, however the problem still persists. As you can see, Nokia 8.1 has nearly reached its end of life, which means only security patches will be pushed to this phone in future updates, not maintainance ones; therefore I can't tell for sure if it's an exclusive problem on this phone or it also happens on other Nokia models.

@pir8skin
Copy link

Hello everyone. I'm having the same problem with NewPipe on my Google Pixel 2. I'm using the latest version (21.12), but it's been happening since at least 21.02 if not earlier. Here's a video of the issue. https://youtu.be/lI3PKMXIGmk

@vehosah

This comment has been minimized.

@vehosah

This comment has been minimized.

@litetex
Copy link
Member

litetex commented Oct 20, 2021

@vehosah

Please add constructive information here.
"It happens to me too" without further context is not helpful → Better give the issue a upvote, so we can prioritize it 😄

@KatoriYuu
Copy link

@litetex It seems to get worse with the current version (0.21.12). Enabling watch history used to temporarily fix the problem, but the trick is useless right now :( . I haven't found any other workaround at the moment, so if you need any more information, please let me know. I'm very willing to help as much as I can :)

@vehosah
Copy link

vehosah commented Oct 21, 2021 via email

@litetex
Copy link
Member

litetex commented Oct 21, 2021

I don't think we can do anything on app side as this is a Android OS bug.

I searched the Google issuetracker for more information and found this:
https://issuetracker.google.com/issues/177022431

Issue description (opened at 2021-01-11):

On Android R, it was observed some occasional crashes, not 100% reproducible.
By the logs, we nailed down the crash to a NULL pointer dereference on Layer.cpp:

A SIGSEV fault was observed.
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc60
Cause: null pointer dereference

It seems the crash is happening in following statement, some issue with == operator overloading but it is not clear how this is causing null pointer access issue.

bool Layer::setFrameRate(FrameRate frameRate) {

if (mCurrentState.frameRate == frameRate) {
return false;
}

However the issue was closed with "This was opened on the wrong component." and I'm unable to find any similar issue.

@kuroodo
Copy link

kuroodo commented Mar 6, 2022

I have experienced this same issue as described in my duplicate issue mentioned above.

I managed to reproduce the crash with Android Studio's android emulator. The emulator is a Pixel 2, API level 30, x86_64, and with play store enabled. I have also reproduced the crash in another emulated device which is a Nexus One, API Level 30, x86_64, and no play store.

To reproduce the crash:

  • Have a fresh installation of NewPipe 0.22.1
  • Go to History and Cache settings
  • Disable Resume Playback
  • Search for or select a video
  • Allow the video to load and begin playing
  • Select a different video

The above steps should produce the crash. Note that this crash does not happen if you play the first video in the background or as a popup. The issue seems to involve the resume playback setting. When this setting is enabled, even on my physical device, the crash no longer occurs. Disabling it causes the crash to occur.

Since the video file is too big, I have uploaded a youtube video showing the crash with LogCat logs.
Here's the log shown in the video
log.txt or https://pastebin.com/gkqYwycA

@AudricV
Copy link
Member

AudricV commented Apr 4, 2022

A validity check of the video surface has been added recently (before setting it), which fixes the background playback of livestreams.

Could you check if the issue still happen with the APK of the PR which fixed it (#8020), please? Thank you!

@enchainingrealm

This comment was marked as resolved.

@AudricV

This comment was marked as resolved.

@kuroodo
Copy link

kuroodo commented Apr 4, 2022

I tried the APK of the PR and can still reproduce the issue using the steps I provided in my previous comment, using the same emulators.

@AudricV
Copy link
Member

AudricV commented Apr 4, 2022

Ok, so the issue seems to be not fixable by us I am afraid, because it's an issue from your Android system on which we cannot do something ourselves (see above).

@Redirion
Copy link
Member

Redirion commented Apr 8, 2022

in case the crash is resulting from setFrameRate the newer ExoPlayer version offers the ability to turn that off:
82138

@ShareASmile
Copy link
Collaborator

ShareASmile commented Jul 6, 2023

@Nista11 Is this still a issue ? on latest version
v0.25.1

@kuroodo
Copy link

kuroodo commented Jul 6, 2023

Issue appears to be fixed for me on v0.25.1

@opusforlife2
Copy link
Collaborator

Closing. Please comment in case it's still not fixed for someone.

@opusforlife2 opusforlife2 added bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software and removed bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software labels Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software
Projects
None yet
Development

Successfully merging a pull request may close this issue.