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 due to PlayerService #6905

Closed
tobiasKaminsky opened this issue Sep 8, 2020 · 15 comments · Fixed by #7340
Closed

Crash due to PlayerService #6905

tobiasKaminsky opened this issue Sep 8, 2020 · 15 comments · Fixed by #7340

Comments

@tobiasKaminsky
Copy link
Member

Steps to reproduce

  1. delete a file
  2. see
2020-09-08 07:20:21.303 com.nextcloud.client E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.nextcloud.client, PID: 10750
    android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{a08f83f u0 com.nextcloud.client/.media.PlayerService}
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1945)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

@ezaquarii this happens on latest dev, and it seems that it is from your foreground fix:
Upon file removed event, FileDisplayActivity onRemoveFileOperationFinish is called and this calls tryStopPlaying.

PR was #6798

@tobiasKaminsky
Copy link
Member Author

Doc from context.startForegroundService(i) says:

Similar to startService(Intent), but with an implicit promise that the Service will call startForeground(int, android.app.Notification) once it begins running.

And this is not true if we only try to stop playback as then directly onStop() is called in PlayerService.
As startForeground is showing a notification, I do not want to show it, and then immediately stop player.

@ezaquarii
Copy link
Collaborator

I'll look into this.

tobiasKaminsky added a commit that referenced this issue Sep 8, 2020
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@tobiasKaminsky
Copy link
Member Author

#6908 I wrote a (failing) test for this.

@ezaquarii
Copy link
Collaborator

@tobiasKaminsky this will be very handy.

@ezaquarii
Copy link
Collaborator

ezaquarii commented Sep 11, 2020

@tobiasKaminsky

I need to think a bit more about the possible fix. On newer API levels, interacting with services in the background is limited by the OS. Quite a lot of our code assumes that you can ping a background service at will.

I need to take a closer look at the player state machine.

I know that the previous PR #6798 addressed a similar issue in different code path, however we can consider what is the lesser evil here - keeping the fix or backing it out - by comparing the severity of those 2 bugs. I have no access to crash logs, but feel free to back out #6798 if you feel that previous bug was less serious.

@AndyScherzinger AndyScherzinger removed this from the Nextcloud App 3.14.0 milestone Oct 2, 2020
This was referenced Nov 3, 2020
@AndyScherzinger
Copy link
Member

Also see #7189 (comment)

@AndyScherzinger
Copy link
Member

Also see #7187 (comment)

@AndyScherzinger
Copy link
Member

Also see #7191 (comment)

@XueSheng-GIT
Copy link

Still can't play videos in 3.14.0 RC2 without crash. Will this be fixed for 3.14.0 final?

@Siggi0904
Copy link

Still crashes with RC2.

This was referenced Nov 16, 2020
@tobiasKaminsky
Copy link
Member Author

There is an APK file in PR #7340, which you can install in parallel to your existing Nextcloud app.
It would be great if you can verify the fix.

@Siggi0904
Copy link

Auch mit der 3.14.0 stable crasht die App.

Fehlerlog:
`********** CAUSE OF ERROR **********
android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{415238b u0 com.nextcloud.client/.media.PlayerService}
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

********** APP INFORMATION **********
ID: com.nextcloud.client
Version: 30140090
Build flavor: gplay

********** DEVICE INFORMATION **********
Brand: OnePlus
Device: OnePlus6
Model: ONEPLUS A6003
Id: QKQ1.190716.003
Product: OnePlus6

********** FIRMWARE **********
SDK: 29
Release: 10
Incremental: 2010042216`

@tobiasKaminsky
Copy link
Member Author

Will be fixed with #7340

@Siggi0904
Copy link

Error still exists.
See: #7470

@tobiasKaminsky
Copy link
Member Author

This should be fixed in 3.14.1 RC2 coming today. You can test it via play store beta program.
If not, please re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants