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

IllegalStateException: Not allowed to start service Intent { cmp=org.wordpress.android/.ui.uploads.UploadService (has ex... #9982

Closed
sentry-io bot opened this issue Jun 5, 2019 · 4 comments · Fixed by #10003

Comments

@sentry-io
Copy link

sentry-io bot commented Jun 5, 2019

Sentry Issue: https://sentry.io/share/issue/ce46c4aed1174adc8612f084a1ee3163/

IllegalStateException: Not allowed to start service Intent { cmp=org.wordpress.android/.ui.uploads.UploadService (has extras) }: app is in background uid UidRecord{c045878 u0a428 TRNB idle change:uncached procs:1 proclist:20759, seq(0,0,0)}
    at org.wordpress.android.ui.uploads.UploadServiceFacade.uploadPost(UploadServiceFacade.kt:16)
    at org.wordpress.android.ui.uploads.LocalDraftUploadStarter$upload$2.invokeSuspend(LocalDraftUploadStarter.kt:140)
...
(5 additional frame(s) were not displayed)

Not allowed to start service Intent { cmp=org.wordpress.android/.ui.uploads.UploadService (has extras) }: app is in background uid UidRecord{c045878 u0a428 TRNB idle change:uncached procs:1 proclist:20759, seq(0,0,0)}

New in 12.6-rc-1/alpha-172

@loremattei
Copy link
Contributor

This may be related as well: https://sentry.io/share/issue/91de278bab854ce99d5feae7d7db98d9/

@maxme
Copy link
Contributor

maxme commented Jun 5, 2019

Full stack trace:

java.lang.IllegalStateException: Not allowed to start service Intent { cmp=org.wordpress.android/.ui.uploads.UploadService (has extras) }: app is in background uid UidRecord{74c6d7 u0a140 TRNB bg:+20m17s858ms idle change:uncached 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.wordpress.android.ui.uploads.UploadServiceFacade.uploadPost(UploadServiceFacade.kt:16)
    at org.wordpress.android.ui.uploads.LocalDraftUploadStarter$upload$2.invokeSuspend(LocalDraftUploadStarter.kt:140)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
    at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)

@malinajirka
Copy link
Contributor

Some observation:

  1. This block doesn't catch the exception even though it should. I'm not sure why 😕

  2. The Job is never canceled. If uploadPost is invoked after the app went to background, it can crash.

  3. We could call ContextCompat.startForegroundService() here which would give us 5s to show a notification. However, the app won't show it without this fix.

I'm not able to reproduce the issue - it probably happens either just on some devices or under some specific circumstances.

@malinajirka
Copy link
Contributor

@loremattei I've double-checked the errors again and I found what I was missing.

https://sentry.io/share/issue/91de278bab854ce99d5feae7d7db98d9/

Is marked as Fatal -> the app crashed. However, it crashed in version 12.5.

https://sentry.io/share/issue/ce46c4aed1174adc8612f084a1ee3163/

Is marked as Error -> the app didn't crash. Since we added try+catch block. This explains why I was not able to reproduce it on 12.6 even when I added explicit throw IllegalStateException statement.

I believe there is no need to create a hotfix as the users don't even know something went wrong - in fact, nothing went wrong as this is an expected exception. Having said that, we'll improve it in 12.7, so we don't log so many expected "errors".

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.

3 participants