-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
App crashes randomly #9358
Comments
Try using mobile data instead of wifi. |
Problem exists with both mobile data and Wifi. Seems worse with mobile. |
And do you see this occur if you follow the steps in #9030? |
I get the crashes without having to change speeds or sizes as in that Issue. I don't get a popup that the app is not responding. I get the "Sorry that should not have happened" crash with diagnostics. |
I believe i am seeing the same thing. my device and crash log is nearly identical as far as I can tell.
initially tried to send via email but the email address doesnt seem to exist anymore. Device: Samsung S10E My primary observation is that I almost never see this error during daily use (i.e. when im intending to use the newpipe app), but it only seemed to appear when i was trying to navigate somewhere in google maps. This error will take over the screen reducing the map to a picture in picture view and then cover that up with a system pipup like "it looks like newpipe crashed" with options to stop the app or wait (or maybe clear cache, i forget). nothing i have tried (including stopping the app from that prompt, waiting for the app, killing the app from task switcher, clearing the cache, force stopping the app, uninstalling and reinstalling) seems to have worked to fix this. Personally I feel as though this is potentially a danger to drivers and may warrant toning down how aggressively the crash reporting wants to be on screen if an error occurs while the app or any of its windows (like picture in picture) aren't visible on screen. |
I'm still experiencing this, as well. The problem appears to correlate moderately with connecting to or switching between networks such as wifi->cellular or cellular->cellular handoff. Might not be exclusive to that though. I remembered an earlier ticket I filed with a similar issue when I had an LGV20 phone and Sprint service: #6012 But, now I have a Samsung phone and a T-Mobile SIM card. I don't know if I am on legacy Sprint network hardware or if I am fully on T-Mobile. Whatever the case, Newpipe worked very well with the Samsung until v24. I have looked all over the Samsung phone to see if there are any network/connectivity settings I could invoke to further troubleshoot this but have not found anything. There are no applicable phone or network updates, either. Question: Does NewPipe expect specific behaviors of connectivity or connection changes from the phone/ISP/whatever that may not be satisfied? That might help me dig specifically into my phone settings. The prior ticket got resolved by some miracle fix at the cellular system level. I have no idea if lightning will strike twice there. (Updated to correct spelling errors and for clarifications) |
the changing networks theory kind of fits with my experience of the error too, since when im using google maps, im usually traveling, but this doesnt seem to always recreate the issue. id be curious if these reproduction steps work to resolve the issue:
given that the error i observed seems to be relating to some background task, i assume it would happen if the app was playing a video in the background and either lost network while playing, it would get into a state where it could (in theory) keep spitting out this error whenever the network changes. This also seems related to a different error i see this fairly often when using the app in the foreground. It happens when i resume watching a video that was started a previous day and run out of buffered video that was loaded the day before. That said, this results in a different, notification + toast style of error and never really looked into it so it may not be the same. Edit: this other kind of error seems to already be documented in #10174 When this other error happens I usually just back out of the video and re open it to cause it to pick up from where I was with no issues. Maybe the bug in this issue is the background equivalent of this other foreground-oriented version i have been noticing? |
I agree that it may not be the definitive cause but might help narrow the possibilities. I'll try your steps over the next few days and report back. Resuming play after a long time: I have trouble with this although I usually don't get a crash. Often the video just spins until I click the 'x' to stop it and restart the video and/or restart Newpipe and then the video - both from time zero. |
I have been having the same issues since 0.24.0. I have tried on both Lineage OS 19.1 and 20, and having only gotten 20 recently, the problem only seems worse with the not responding popup happening repeatedly every couple of seconds when it starts, rather than only every so often. It seems to be an issue with background usage and opening other apps, as it seems like if i switch off newpipe for a while and try go back on it, it crashes, and if I try use the background player that also often causes it to crash. |
I'm also getting this stack trace but can consistently replicate it. Open a pop-up player, tap on a timestamp in a comment, then pull the pop up player to the close icon. App crashes with that same trace. |
@OldGuyInTheClub any results? I'd love to root-cause this if possible in case that reveals that the fix is something simple that i can just throw up a PR and/or dev build for to have people test |
I'm very sorry - I haven't had a chance to test your steps yet. Just today I updated to the latest 0.25.0. Still getting a crash when the phone loses connection with my home wifi and finds the cellular network. I don't normally use Google Maps but, FWIW, I didn't see the issue while using Waze (Google product) but this is an observation and not a full-on test. I wonder if it has something to do with how the phone/apps handle interruptions whether it is in the network connection or not. I have another music app that will randomly disconnect on me even when there is a good signal. There are so many services going on in the background that resource conflicts may be unavoidable. There is not too much traffic on this issue so maybe there's some weird mix of circumstances affecting us but not others. |
This comment was marked as spam.
This comment was marked as spam.
I'd like to add, I suspect something changed in Android or Google play services. I have multiple apps complaining of being unable to start background processes, including ones where battery optimization is off. Seems by this thread I'm not the only one |
Actually now that you point that out, im reminded of https://dontkillmyapp.com/. They seem to be on top of these kinds of changes and may have more info about this problem |
Possibly better, easier to reproduce steps that get the app to crash:
my suspicion/theory as to why this happens is that some network connection becomes stale/disconnected and the app tries to reuse a now-stale connection when attempting to download more video to add to the buffer |
I found an even better method to the above. Play the video in pop-up mode and open another app. Let the buffer become empty and the video will freeze up completely with a network error and/or the background error |
Could this be solved in principle by having a "Download and enqueue" feature so videos would play from local storage? I know this requires coding but it may be easier than trying to fix something deep in the gizzards affecting only a few users. I can submit a Feature Request if appropriate. |
Maybe? I guess? Most if it exists already with the download feature tho.
Tried this and couldn't reproduce it. Do you have more info on how you tested this? |
Nope, just exactly like that. Nothing special. Man this is a weird bug we've found. |
I can definitely download files and play them in an external player. This would be a convenience to stay within one app. I'll submit a feature request and see where it goes. |
String (the exact version number, letters included)
…On Sun, Aug 6, 2023, 7:38 PM Adrian Edwards ***@***.***> wrote:
What is an STR?
idk, probably the same concept as reproduction steps though.
—
Reply to this email directly, view it on GitHub
<#9358 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACFTL6AID6Z3AZSVHJJTQETXUATGHANCNFSM6AAAAAAR4EQJXU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ah, Steps To Reproduce perhaps. I have done so. |
i concur with the 0.24.1 reproducible version already in there - ive had issues on more recent versions, but they most likely aren't the same issue. Although i think the player in that version has been broken due to youtube constantly changing things, so it may not even be usable for testing this anyway since most of the repro steps rely on actually loading content. @opusforlife2 are you aware of any changes in versions since 0.24.1 that would make the app more reliable under changing network conditions? |
I left the original report for 0.24.1 as-is and added an update. |
No specific change or changes. But a lot of things get refactored in newer versions, so it's worth testing. |
I think this a good theory. I have the same error from time to time. In my case I think the disconnect happens because I have two access points with same SSID and my phone dictates the roaming strategy. Means, I cannot influence when my phone will switch from 2,4 GHz to 5 GHz network and vise versa. It would be super nice, if NewPipe was more resilient against network interrupts. |
I have to correct the statement a bit. Now I had more time monitoring it and I noticed the app crashes with 403 even without network changes. Like this the app is close to unusable because after crash I cannot resume the video. I always have to force close the app and restart the video..but for how many minutes of playtime? |
the 403 error might be off topic for this issue (or tangentially related at best) and it was my mistake for mentioning it in this issue - here is the issue tracking that specific problem: #10174 taking a surface-level look at some of the other issues that it links to does seem to suggest a certain similarity to the symptoms discovered here (vaguely related to network changes, but also happening on a stable network). The devs may be more equipped to examine the true causes than I am though |
Checking in again to see if there are any insights on why this problem could have started with v24.0 after working with prior versions. The Releases page shows a number of changes incorporated into v24.0 but I have no idea if any/any combination of them could be responsible. Alternately, I'm comfortable with closing this issue if there is no alternative but to live with/work around the crashes. |
I think I found the cause of the issue. The player service seems to be only started in the foreground after playback has been initialized (so after the ExoPlayer instance is created and probably after stream info is loaded). If this process takes a lot of time, a This issue was also present in the past and has been resolved with fbcdaa7. In 0.23.3, the notification was created and the service was putted in the foreground state before handling the intent which started playback in the player, see the following code:
The fix was then removed in 0.24.0: see 76ced59#diff-a9f8070f8db88aff3228ca5d69babc66fc7dd3df469e1cdc935ce426aea20178L109. So the issue should be fixed by reintroducing the creation of the player service notification and starting the player service in foreground before handling intents in the player. This would also reintroduce the ghost notification when you use a media button on an external device such as a Bluetooth one and NewPipe was the last media app used. I think the issue can be resolved by stopping the player service when there is nothing to play and a media button receiver intent is received. The following patch should solve the issue and the one I described which would come back: Subject: [PATCH] Create notification and start player service in foreground when creating in the player
This behavior was present before 0.24.0 and the player UI separation and
avoided crashes for which their exception contained
"Context.startForegroundService() did not then call Service.startForeground()".
Some player nullability checks have been also added.
---
Index: app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java
--- a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java (revision b5463cf5e14e9b98cb97744cc3dfb5e34a315259)
+++ b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationPlayerUi.java (date 1694718257649)
@@ -17,7 +17,6 @@
import org.schabi.newpipe.player.ui.PlayerUi;
public final class NotificationPlayerUi extends PlayerUi {
- private boolean foregroundNotificationAlreadyCreated = false;
private final NotificationUtil notificationUtil;
public NotificationPlayerUi(@NonNull final Player player) {
@@ -25,15 +24,6 @@
notificationUtil = new NotificationUtil(player);
}
- @Override
- public void initPlayer() {
- super.initPlayer();
- if (!foregroundNotificationAlreadyCreated) {
- notificationUtil.createNotificationAndStartForeground();
- foregroundNotificationAlreadyCreated = true;
- }
- }
-
@Override
public void destroy() {
super.destroy();
@@ -122,4 +112,8 @@
super.onPlayQueueEdited();
notificationUtil.createNotificationIfNeededAndUpdate(false);
}
+
+ public void createNotificationAndStartForeground() {
+ notificationUtil.createNotificationAndStartForeground();
+ }
}
Index: app/src/main/java/org/schabi/newpipe/player/PlayerService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java
--- a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java (revision b5463cf5e14e9b98cb97744cc3dfb5e34a315259)
+++ b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java (date 1694718373526)
@@ -29,6 +29,7 @@
import android.util.Log;
import org.schabi.newpipe.player.mediasession.MediaSessionPlayerUi;
+import org.schabi.newpipe.player.notification.NotificationPlayerUi;
import org.schabi.newpipe.util.ThemeHelper;
import java.lang.ref.WeakReference;
@@ -59,6 +60,13 @@
ThemeHelper.setTheme(this);
player = new Player(this);
+
+ // Create the player notification and start immediately the service in foreground,
+ // otherwise if nothing is played or initializing the player and its components (especially
+ // loading stream metadata) takes a lot of time, the app would crash on Android 8+ as the
+ // service would never be put in the foreground while we said to the system we would do so
+ player.UIs().get(NotificationPlayerUi.class)
+ .ifPresent(NotificationPlayerUi::createNotificationAndStartForeground);
}
@Override
@@ -69,9 +77,11 @@
}
if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())
- && player.getPlayQueue() == null) {
- // No need to process media button's actions if the player is not working, otherwise the
- // player service would strangely start with nothing to play
+ && (player == null || player.getPlayQueue() == null)) {
+ // No need to process media button's actions if the player is not working, otherwise
+ // the player service would strangely start with nothing to play
+ // Stop the service in this case
+ stopSelf();
return START_NOT_STICKY;
}
@@ -87,7 +97,7 @@
Log.d(TAG, "stopForImmediateReusing() called");
}
- if (!player.exoPlayerIsNull()) {
+ if (player != null && !player.exoPlayerIsNull()) {
// Releases wifi & cpu, disables keepScreenOn, etc.
// We can't just pause the player here because it will make transition
// from one stream to a new stream not smooth
@@ -98,7 +108,7 @@
@Override
public void onTaskRemoved(final Intent rootIntent) {
super.onTaskRemoved(rootIntent);
- if (!player.videoPlayerSelected()) {
+ if (player != null && !player.videoPlayerSelected()) {
return;
}
onDestroy(); I built a debug APK with these changes based on b1ab261, could you test if it fixes the issue? Thanks in advance. |
This is terrific! I don't understand the details but I think I follow the argument at the proverbial 100-kft level. @AudricV : Is it me you would like to test this fix or the devs? If me, can you let me know how best to proceed? Should I:
Thank you for your deep dive into this problem. |
@OldGuyInTheClub Yes, I ask you to test this debug build, importing existing settings and database shouldn't matter, but please do so to be sure the problem doesn't happen with existing data. You don't need to uninstall the official release of the app. |
Will do. Will get back to you in a couple of days. |
@AudricV I am very encouraged! I've used your APK for 48+ hours and I can go from home wifi to the cellular network, drive around far enough to switch to multiple towers, go in and out of airplane mode, and so far no crashes. I backed up my NewPipe data and imported it into this version. If it's ok with you, I'd like to monitor it for a few more days just to be sure. |
@AudricV I've installed your test build last night, and this morning I once again got the Actions taken:
Running GrapheneOS (Android 13) on a Pixel 6 Error:
|
@annervisser Could you provide the complete stack trace of the corresponding crash which should happen when closing the player, according to similar reports? |
@AudricV I screen recorded it, in case that's of any help: signal-2023-09-21-12-55-47-192.mp4Exception
Crash log
Another trace from a different crash:
|
@annervisser FWIW, I tried your steps several times but did not get any crashes although my config may be different from yours. I had to turn off screen rotate to get the fullscreen button to appear. The back gesture (swipe) didn't work so I used the back arrow at the bottom of the screen instead. Galaxy S10+, OneUI, Android 12.4.14.190, last s/w update September 8, 2023 |
@AudricV No crashes after two more days. I think you've fixed it for me, at least. If the patch is not accepted for whatever reason into the next release, is there anything I can do on the phone side to prevent this problem? Maybe there is a Developer setting, configuration change, or something else to set? |
I was also having this issue. Looks like the build provided by @AudricV seems to solve the problem though. Hope now that it's solved it gets fixed in the next release. |
The fix also resolved two other problems I was having:
|
That lools like you've disabled search and watch history in the settings. Can you check that for us, please? |
Settings -> History and Cache: Watch history, Resume playback, Positions in lists, and Search history are enabled in both Newpipe 25.2 and @AudricV's Debug version. Added thoughts: Speculation: When the software was crashing, perhaps things like new search entries got dropped because files that would have/should have gotten updated did not? Regarding resuming playback, I filed this Feature Request a long time ago to get around the problem #4574 |
Checklist
Affected version
0.24.1 (but also saw in 0.24)
Steps to reproduce the bug
UPDATED 6 August 2023 with v0.25.2
OR b) Reload subscriptions or otherwise interact with the app: Sometimes (but not all) app will crash with a Guru Meditation error
or
Change in behavior: Guru Meditation error no longer goes into infinite loop. Still steals focus as always but it is possible to swipe dismiss the app and restart. Usually it will work for a while after one or two restarts and then the problem happens again
Expected behavior
App used to work great. Started having this problem with 0.24. Hoped 0.24.1 would fix it but didn't
Actual behavior
Regular crashes
Screenshots/Screen recordings
No response
Logs
Exception
Crash log
Affected Android/Custom ROM version
Android 12 4.14.190 - stock, no custom ROM, no root
Affected device model
Samsung Galaxy S10+, US T Mobile
Additional information
Closest relevant recent Open Issue is #9163 but my problem doesn't happen immediately on startup.
Closest Closed Issue is #9339
but afaik, there isn't a fix (looked at other referenced Issues)
Steps tried.
Delay between app start and crash not perfectly reproducible. Occasionally it will be stable for a few minutes but once a crash happens, it will repeat 10-15 seconds after every restart for some time after which it will be stable for a little while before starting the quick crash pattern
Problem is not affected by VPN state
Weak correlation with signal strength: Wifi connections appear to take longer between crashes relative to cellular network. Can't prove it. Just an observation.
I don't have the tools or skill to get any bug report beyond the Guru Meditation dump provided in the Logs box
The text was updated successfully, but these errors were encountered: