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

Crash when running two newpipe instances at the same time: java.lang.RuntimeException: Error receiving broadcast intent… #4653

Closed
4 tasks done
B0pol opened this issue Oct 26, 2020 · 10 comments · Fixed by #5221
Labels
bug Issue is related to a bug

Comments

@B0pol
Copy link
Member

B0pol commented Oct 26, 2020

Checklist

Steps to reproduce the bug

  • (optional?) uninstall all newpipe apps
  • install newpipe 0.20.1
  • install a newpipe debug version, to have multiple newpipes at the same time
  • open a video

Actual behaviour

Crash

Expected behavior

Everything works fine

Logs

Exception

  • User Action: ui error
  • Request: App crash, UI failure
  • Content Country: FR
  • Content Language: fr-FR
  • App Language: fr_FR
  • Service: none
  • Version: 0.20.1
  • OS: Linux Android 9 - 28
Crash log

java.lang.RuntimeException: Error receiving broadcast Intent { act=org.schabi.newpipe.VideoDetailFragment.ACTION_PLAYER_STARTED flg=0x10 } in org.schabi.newpipe.fragments.detail.VideoDetailFragment$4@4feadd9
	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1401)
	at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
	at android.os.Handler.handleCallback(Handler.java:873)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:6718)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=org.schabi.newpipe/.player.MainPlayer }: app is in background uid UidRecord{1b3bf85 u0a590 CAC  bg:+2m34s765ms idle procs:1 seq(0,0,0)}
	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
	at android.app.ContextImpl.startService(ContextImpl.java:1532)
	at android.content.ContextWrapper.startService(ContextWrapper.java:664)
	at org.schabi.newpipe.player.helper.PlayerHolder.startService(PlayerHolder.java:59)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment$4.onReceive(VideoDetailFragment.java:1343)
	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1391)
	... 8 more


Device info

  • Android version/Custom ROM version: Android 9
  • Device model: Pocophone F1
@B0pol B0pol added the bug Issue is related to a bug label Oct 26, 2020
@Stypox
Copy link
Member

Stypox commented Oct 26, 2020

I don't think we should put any effort into fixing this. Usually users do not have multiple NewPipes

@opusforlife2
Copy link
Collaborator

Also, this conflict doesn't happen between two release builds. At least one of them has to be a debug build.

@Stypox But testers do have multiple Newpipes. And testing often involves comparing differences between them, especially when videos are playing. Testing would become absolute hell if I had to test one build, close it, then open the other and then test it, back and forth, back and forth.

So to me this isn't low priority at all. Medium priority at least. :P

@opusforlife2
Copy link
Collaborator

Or developers would have to ensure they're uploading release builds.

@opusforlife2
Copy link
Collaborator

A debug build doesn't cause problems when used alongside a pre-0.20.0 debug build. So there is definitely something in the new version. My guess is the notification code, since that also seems to cause other problems as users have noted.

@Sunshinesol

This comment has been minimized.

@B0pol
Copy link
Member Author

B0pol commented Oct 27, 2020

I don't think we should put any effort into fixing this. Usually users do not have multiple NewPipes

When they test, they do. When they install a debug apk which fixes newpipe (right now), they do.

@XiangRongLin
Copy link
Collaborator

XiangRongLin commented Oct 27, 2020

I have a similar problem too. when running multiple debug builds and having their notification present. if you close one, then start playing on the other, the closed one appears again.

I remember seeing in the code somewhere a hardcoded ID for broadcast (or something similar) towards the notifications. With multiple apps they would all them receive it.

Edit:

private static final int NOTIFICATION_ID = 123789;

@avently
Copy link
Contributor

avently commented Oct 28, 2020

All broadcasts should use package name instead of hardcoded strings

@B0pol
Copy link
Member Author

B0pol commented Oct 31, 2020

Not to mention the related bugs: if you pause one NewPipe, the other one will resume. If you delete the notification from one NewPipe, the other one will delete notification too

@B0pol
Copy link
Member Author

B0pol commented Dec 19, 2020

I have a similar problem too. when running multiple debug builds and having their notification present. if you close one, then start playing on the other, the closed one appears again.

I remember seeing in the code somewhere a hardcoded ID for broadcast (or something similar) towards the notifications. With multiple apps they would all them receive it.

Edit:

private static final int NOTIFICATION_ID = 123789;

The actual reason is because package name isn't org.schabi.newpipe on debug builds.

static final String ACTION_CLOSE
= "org.schabi.newpipe.player.MainPlayer.CLOSE";
static final String ACTION_PLAY_PAUSE
= "org.schabi.newpipe.player.MainPlayer.PLAY_PAUSE";
static final String ACTION_OPEN_CONTROLS
= "org.schabi.newpipe.player.MainPlayer.OPEN_CONTROLS";
static final String ACTION_REPEAT
= "org.schabi.newpipe.player.MainPlayer.REPEAT";
static final String ACTION_PLAY_NEXT
= "org.schabi.newpipe.player.MainPlayer.ACTION_PLAY_NEXT";
static final String ACTION_PLAY_PREVIOUS
= "org.schabi.newpipe.player.MainPlayer.ACTION_PLAY_PREVIOUS";
static final String ACTION_FAST_REWIND
= "org.schabi.newpipe.player.MainPlayer.ACTION_FAST_REWIND";
static final String ACTION_FAST_FORWARD
= "org.schabi.newpipe.player.MainPlayer.ACTION_FAST_FORWARD";
static final String ACTION_SHUFFLE
= "org.schabi.newpipe.player.MainPlayer.ACTION_SHUFFLE";
public static final String ACTION_RECREATE_NOTIFICATION
= "org.schabi.newpipe.player.MainPlayer.ACTION_RECREATE_NOTIFICATION";

B0pol added a commit to B0pol/NewPipe that referenced this issue Dec 19, 2020
it fixes issues with forks or debug builds, e.g. when you open two newpipe apps (with debug or fork apps), close one notification, it closes all newpipe notifications
fixes TeamNewPipe#4653
B0pol added a commit to B0pol/NewPipe that referenced this issue Dec 19, 2020
it fixes issues with forks or debug builds, e.g. when you open two newpipe apps (with debug or fork apps), close one notification, it closes all newpipe notifications
fixes TeamNewPipe#4653
B0pol added a commit to B0pol/NewPipe that referenced this issue Dec 19, 2020
it fixes issues with forks or debug builds, e.g. when you open two newpipe apps (with debug or fork apps), close one notification, it closes all newpipe notifications
fixes TeamNewPipe#4653
B0pol added a commit to B0pol/NewPipe that referenced this issue Dec 20, 2020
it fixes issues with forks or debug builds, e.g. when you open two newpipe apps (with debug or fork apps), close one notification, it closes all newpipe notifications
fixes TeamNewPipe#4653
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants