Skip to content

Crash due to PlayerService #6905

Closed

Description

@tobiasKaminsky

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

Activity

  1. tobiasKaminsky commented on Sep 8, 2020

    @tobiasKaminsky
    MemberAuthor

    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.

  2. ezaquarii commented on Sep 8, 2020

    @ezaquarii
    Collaborator

    I'll look into this.

  3. added a commit that references this issue on Sep 8, 2020
  4. tobiasKaminsky commented on Sep 8, 2020

    @tobiasKaminsky
    MemberAuthor

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

  5. ezaquarii commented on Sep 9, 2020

    @ezaquarii
    Collaborator

    @tobiasKaminsky this will be very handy.

  6. ezaquarii commented on Sep 11, 2020

    @ezaquarii
    Collaborator

    @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.

  7. removed this from the Nextcloud App 3.14.0 milestone on Oct 2, 2020
  8. AndyScherzinger commented on Nov 3, 2020

    @AndyScherzinger
    Member
  9. AndyScherzinger commented on Nov 3, 2020

    @AndyScherzinger
    Member
  10. AndyScherzinger commented on Nov 3, 2020

    @AndyScherzinger
    Member
  11. XueSheng-GIT commented on Nov 11, 2020

    @XueSheng-GIT

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

  12. Siggi0904 commented on Nov 14, 2020

    @Siggi0904

    Still crashes with RC2.

  13. tobiasKaminsky commented on Nov 17, 2020

    @tobiasKaminsky
    MemberAuthor

    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.

  14. Siggi0904 commented on Nov 19, 2020

    @Siggi0904

    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`

  15. tobiasKaminsky commented on Nov 20, 2020

    @tobiasKaminsky
    MemberAuthor

    Will be fixed with #7340

  16. added a commit that references this issue on Nov 24, 2020
  17. Siggi0904 commented on Nov 24, 2020

    @Siggi0904

    Error still exists.
    See: #7470

  18. tobiasKaminsky commented on Nov 25, 2020

    @tobiasKaminsky
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions