Skip to content

Offline Support : Pages - handlePostUploadedWithoutError continuation issue #11264

Description

@jd-alexander

Expected behavior

When a post is created and the Up button is pressed then it should just perform the auto-save without error.

Actual behavior

There are times when a crash occurs, seemingly because the continuation that represents the current upload was already resumed.

2020-02-07 11:45:13.904 E: FATAL EXCEPTION: DefaultDispatcher-worker-4
    Process: org.wordpress.android.beta, PID: 5736
    java.lang.IllegalStateException: Already resumed, but proposed with update kotlin.Unit
        at kotlinx.coroutines.CancellableContinuationImpl.alreadyResumedError(CancellableContinuationImpl.kt:332)
        at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:327)
        at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:247)
        at org.wordpress.android.viewmodel.pages.PagesViewModel.handlePostUploadedWithoutError(PagesViewModel.kt:701)
        at org.wordpress.android.viewmodel.pages.PagesViewModel$start$1.invoke(PagesViewModel.kt:185)
        at org.wordpress.android.viewmodel.pages.PagesViewModel$start$1.invoke(PagesViewModel.kt:76)
        at org.wordpress.android.viewmodel.pages.PageListEventListener$onPostChanged$1.invokeSuspend(PageListEventListener.kt:100)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655)

Steps to reproduce the behavior

  1. I created a post.
  2. added a title
  3. Click on "Up" button in the editor.
Tested on WPAndroid #11191

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions