wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.99k stars 1.32k forks source link

[GlobalStep] [Android] Randomly error message flashes after brief amount of time while uploading assets during publishing or saving any drafts. #12001

Closed gglobalstep closed 3 years ago

gglobalstep commented 4 years ago

Environment: Android: Samsung Galaxy s9 (v10), Samsung Galaxy S7 (v8), Samsung Galaxy Tab A (v9). Build WPAndroid [version]: v14.9

Steps To Reproduce:

  1. Install and launch the application.

    1. Tap on "Log In".
    2. Log in to the app using valid credentials.
    3. Go to My site and tap on "Pages" icon.
    4. Go to Drafts and tap on "CREATE A PAGE" button.
    5. Select any one of the templates say "Service" and tap on "Apply" option.
    6. Insert images/gallery/cover block and upload pictures from any one of the options say "Take a Photo".

    Scenario 1 (PUBLISHED TAB):

    1. Note: while image is uploading, Tap on "PUBLISH" option.
    2. Tap on "PUBLISH NOW" option when "Ready to Publish?" popup appears .
  2. Note on "PUBLISHED" tab->Page with "Uploading media.." will get added to the list.
  3. Tap on create a new page icon on "DRAFTS" tab.
  4. Repeat steps 6,7 from above and 8,9 from Published scenario.
  5. Note on "PUBLISHED" tab->Page with "Uploading media.." will get added to the list.
  6. Observe that after sometime randomly an error message "We couldn't upload this media. and didn't publish the page." is displayed for the page and it disappears after sometime.

    Scenario 2 (DRAFTS TAB):

    1. Tap back arrow icon
    2. Note that Page with "Uploading media.." will get added in the DRAFTS tab list.Tap on create a new page icon.
  7. Repeat steps 6,7 from above and 8 from drafts scenario.
  8. Note that Page with "Queued page.." will get added in the DRAFTS tab list
  9. Observe that after sometime randomly an error message "We couldn't complete this action." is displayed for the page and it disappears after sometime.

    Actual Result: After brief amount of time while uploading, randomly these error messages flashes for a while for following tabs: a. "We couldn't upload this media. and didn't publish the page." for PUBLISHED tab. b. "We couldn't complete this action." gets displayed for DRAFTS tab.

Expected Result: Application should any error messages when pages are getting saved in drafts or getting published.

Attachment: #2289.zip

designsimply commented 4 years ago

Screenshots from the attachment:

#2289_Scenario 1 #2289_Scenario2

designsimply commented 4 years ago

Moving to WordPress-Android for further investigation because this appears to be an issue in the Posts List or the publishing mechanism and does not appear to be an issue directly related to the editor.

designsimply commented 4 years ago

Good find! Tested and confirmed using the steps provided, except I also saw some crashes. (5m11s)

App logs for the timestamp matching the video with token info removed ``` WordPress - 14.9-rc-1 - Version code: 867 Android device name: Google Pixel 3 01 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 02 - [May-22 23:22 PROFILING] App Startup: 70 ms, WPMainActivity.onCreate 03 - [May-22 23:22 PROFILING] App Startup: 141 ms, WPMainActivity.onResume 04 - [May-22 23:22 PROFILING] App Startup: end, 211 ms 05 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 06 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 07 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 08 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 09 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 10 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 11 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 12 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 13 - [May-22 23:22 API] Dispatching action: SiteAction-FETCH_POST_FORMATS 14 - [May-22 23:22 API] Dispatching action: SiteAction-FETCH_SITE_EDITORS 15 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 16 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 17 - [May-22 23:22 STATS] šŸ”µ Tracked: auto_upload_page_invoked, Properties: {"upload_action":"UPLOAD","post_status":"publish"} 18 - [May-22 23:22 POSTS] UploadStarter for post (isPage: true) title: Services, action: UPLOAD 19 - [May-22 23:22 API] Dispatching action: UploadAction-INCREMENT_NUMBER_OF_AUTO_UPLOAD_ATTEMPTS 20 - [May-22 23:22 STATS] šŸ”µ Tracked: auto_upload_page_invoked, Properties: {"upload_action":"UPLOAD","post_status":"publish"} 21 - [May-22 23:22 POSTS] UploadStarter for post (isPage: true) title: Services, action: UPLOAD 22 - [May-22 23:22 API] Dispatching action: UploadAction-INCREMENT_NUMBER_OF_AUTO_UPLOAD_ATTEMPTS 23 - [May-22 23:22 UTILS] Connection status changed, isConnected=true 24 - [May-22 23:22 NOTIFS] notifications update job service > created 25 - [May-22 23:22 MAIN] UploadService > Created 26 - [May-22 23:22 MEDIA] MediaUploadHandler > Created 27 - [May-22 23:22 POSTS] PostUploadHandler > Created 28 - [May-22 23:22 NOTIFS] Sending GCM token to our remote services: 29 - [May-22 23:22 NOTIFS] notifications update job service > destroyed 30 - [May-22 23:22 NOTIFS] notifications update job service > created 31 - [May-22 23:22 API] Dispatching action: AccountAction-FETCHED_ACCOUNT 32 - [May-22 23:22 API] Dispatching action: AccountAction-FETCHED_SETTINGS 33 - [May-22 23:22 API] Dispatching action: AccountAction-FETCHED_ACCOUNT 34 - [May-22 23:22 API] Received site Categories 35 - [May-22 23:22 API] Successfully fetched WP.com categories 36 - [May-22 23:22 API] Received response to Settings REST request. 37 - [May-22 23:22 API] Dispatching action: SiteAction-UPDATE_SITE 38 - [May-22 23:22 API] Dispatching action: SiteAction-FETCHED_POST_FORMATS 39 - [May-22 23:22 SETTINGS] An error occurred while updating the post formats with type: INVALID_RESPONSE 40 - [May-22 23:22 DB] Site found by (local) ID: 3 41 - [May-22 23:22 DB] Updating site: http://fashionsite.fashion.blog 42 - [May-22 23:22 API] Dispatching action: SiteAction-FETCHED_SITE_EDITORS 43 - [May-22 23:22 DB] Site found by (local) ID: 3 44 - [May-22 23:22 DB] Updating site: http://fashionsite.fashion.blog 45 - [May-22 23:22 API] Dispatching action: SiteAction-FETCHED_SITE_EDITORS 46 - [May-22 23:22 DB] Site found by (local) ID: 3 47 - [May-22 23:22 DB] Updating site: http://fashionsite.fashion.blog 48 - [May-22 23:22 NOTIFS] Register token action succeeded 49 - [May-22 23:22 NOTIFS] Server response OK. The device_id: 36148123 50 - [May-22 23:22 API] Dispatching action: SiteAction-FETCHED_SITES 51 - [May-22 23:22 DB] Site found by SITE_ID: 160502386 52 - [May-22 23:22 DB] Updating site: http://artindesignco.blog 53 - [May-22 23:22 DB] Site found by SITE_ID: 160991665 54 - [May-22 23:22 DB] Updating site: http://gotravelrewards.blog 55 - [May-22 23:22 DB] Site found by SITE_ID: 161935399 56 - [May-22 23:22 DB] Updating site: http://fashionsite.fashion.blog 57 - [May-22 23:22 DB] Site found by SITE_ID: 5276229 58 - [May-22 23:22 DB] Updating site: https://design5279.wordpress.com 59 - [May-22 23:22 DB] Site found by SITE_ID: 160805144 60 - [May-22 23:22 DB] Updating site: http://wibblywobblytimeywimey.travel.blog 61 - [May-22 23:22 DB] Site found by SITE_ID: 175550820 62 - [May-22 23:22 DB] Updating site: https://flaky-sheep.jurassic.ninja 63 - [May-22 23:22 DB] Site found by SITE_ID: 160948467 64 - [May-22 23:22 DB] Updating site: http://lovinglycompetitivestorytelling.news.blog 65 - [May-22 23:22 DB] Site found by SITE_ID: 159889361 66 - [May-22 23:22 DB] Updating site: http://made4testing0318.blog 67 - [May-22 23:22 DB] Site found by SITE_ID: 159662180 68 - [May-22 23:22 DB] Updating site: https://madefortesting190313.wordpress.com 69 - [May-22 23:22 DB] Site found by SITE_ID: 160991226 70 - [May-22 23:22 DB] Updating site: https://musictosingoutloud.wordpress.com 71 - [May-22 23:22 DB] Site found by SITE_ID: 160808369 72 - [May-22 23:22 DB] Updating site: https://myfiadventures.wordpress.com 73 - [May-22 23:22 DB] Site found by SITE_ID: 160805604 74 - [May-22 23:22 DB] Updating site: https://myrandomyoutubevideos.wordpress.com 75 - [May-22 23:22 DB] Site found by SITE_ID: 161701929 76 - [May-22 23:22 DB] Updating site: http://thetimeywimeykindof.family.blog 77 - [May-22 23:22 DB] Site found by SITE_ID: 161693475 78 - [May-22 23:22 DB] Updating site: http://youtubevideosilike.movie.blog 79 - [May-22 23:22 NOTIFS] notifications update service > completed 80 - [May-22 23:22 NOTIFS] notifications update job service > all tasks completed 81 - [May-22 23:22 NOTIFS] notifications update job service > destroyed 82 - [May-22 23:22 API] Dispatching action: AccountAction-FETCHED_SUBSCRIPTIONS 83 - [May-22 23:22 STATS] šŸ”µ Tracked: quick_action_tapped, Properties: {"button":"pages"} 84 - [May-22 23:22 STATS] šŸ”µ Tracked: site_menu_opened, Properties: {"blog_id":161935399,"is_jetpack":false,"menu_item":"pages"} 85 - [May-22 23:22 POSTS] PageStore: getPagesFromDb 86 - [May-22 23:22 POSTS] PageStore: getPagesWithLocalChanges 87 - [May-22 23:22 API] Dispatching action: PostAction-FETCH_PAGES 88 - [May-22 23:22 API] Dispatching action: PostAction-FETCHED_POSTS 89 - [May-22 23:22 POSTS] PageStore: getPagesFromDb 90 - [May-22 23:26 POSTS] PageStore: getPagesWithLocalChanges 91 - [May-22 23:26 API] Dispatching action: PostAction-FETCH_PAGES 92 - [May-22 23:26 API] Dispatching action: PostAction-FETCHED_POSTS 93 - [May-22 23:26 POSTS] PageStore: getPagesFromDb 94 - [May-22 23:29 UTILS] trackLastActivity, activityId: My Site 95 - [May-22 23:29 API] Dispatching action: AccountAction-FETCH_ACCOUNT 96 - [May-22 23:29 API] Dispatching action: AccountAction-FETCHED_ACCOUNT 97 - [May-22 23:29 STATS] šŸ”µ Tracked: me_tab_accessed 98 - [May-22 23:29 STATS] šŸ”µ Tracked: support_opened, Properties: {"origin":"ME_SCREEN_HELP"} 99 - [May-22 23:29 UTILS] trackLastActivity, activityId: Help Screen ```

Tested with WPAndroid 14.9-rc-1 on Pixel 3 Android 10.

Note: the crash I saw is being tracked at https://github.com/wordpress-mobile/WordPress-Android/issues/11992 actually this one WORDPRESS-ANDROID-C15. h/t @ashiagr for pointing me in the right direction!

khaykov commented 4 years ago

After getting the page stuck in Queue, like in @designsimply's video or in Local Draft state (after app restart) trying to open it while another page is being uploaded results in a crash. replaceMediaFileWithUrlInGutenbergPost hints that it might be something related to Gutenberg. Summoning @hypest for second opinion.

Image from Gyazo

  Process: org.wordpress.android, PID: 11562
    java.lang.RuntimeException: Unable to start activity ComponentInfo{org.wordpress.android/org.wordpress.android.ui.posts.EditPostActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.gson.JsonElement.getAsString()' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
        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)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.gson.JsonElement.getAsString()' on a null object reference
        at org.wordpress.android.ui.posts.mediauploadcompletionprocessors.ImageBlockProcessor.processBlockJsonAttributes(ImageBlockProcessor.java:34)
        at org.wordpress.android.ui.posts.mediauploadcompletionprocessors.BlockProcessor.processBlock(BlockProcessor.java:91)
        at org.wordpress.android.ui.posts.mediauploadcompletionprocessors.MediaUploadCompletionProcessor.processBlock(MediaUploadCompletionProcessor.java:78)
        at org.wordpress.android.ui.posts.mediauploadcompletionprocessors.MediaUploadCompletionProcessor.processContent(MediaUploadCompletionProcessor.java:59)
        at org.wordpress.android.ui.posts.mediauploadcompletionprocessors.MediaUploadCompletionProcessor.processContent(MediaUploadCompletionProcessor.java:60)
        at org.wordpress.android.ui.posts.PostUtils.replaceMediaFileWithUrlInGutenbergPost(PostUtils.java:429)
        at org.wordpress.android.ui.uploads.MediaUploadReadyProcessor.replaceMediaFileWithUrlInPost(MediaUploadReadyProcessor.java:25)
        at org.wordpress.android.ui.uploads.UploadService.updatePostWithMediaUrl(UploadService.java:611)
        at org.wordpress.android.ui.uploads.UploadService.updatePostWithCurrentlyCompletedUploads(UploadService.java:459)
        at org.wordpress.android.ui.posts.EditPostActivity.lambda$oKXGGak0_lNLvZhk4qsl8ml6C7w(Unknown Source:0)
        at org.wordpress.android.ui.posts.-$$Lambda$EditPostActivity$oKXGGak0_lNLvZhk4qsl8ml6C7w.invoke(Unknown Source:2)
        at org.wordpress.android.ui.posts.EditPostRepository.replace(EditPostRepository.kt:135)
        at org.wordpress.android.ui.posts.EditPostActivity.initializePostObject(EditPostActivity.java:700)
        at org.wordpress.android.ui.posts.EditPostActivity.onCreate(EditPostActivity.java:487)
        at android.app.Activity.performCreate(Activity.java:7802)
        at android.app.Activity.performCreate(Activity.java:7791)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)Ā 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)Ā 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)Ā 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)Ā 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)Ā 
        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)Ā 
hypest commented 4 years ago

Thanks for the ping @khaykov , block editor related code seems indeed involved. šŸ‘‹ @mkevins , can you help with investigating this one? Also, to help share the knowledge, can you look into this @marecar3 too and collaborate with Matt? Thanks!

mkevins commented 4 years ago

Yes indeed! There's a separate issue to track the NPE in processors, and I've found at least one cause. I'm checking for others, and will have a PR soon.

mkevins commented 4 years ago

Awesome job on the details for reproducing @gglobalstep and @khaykov ! I've drafted a PR for the NPEs here: https://github.com/wordpress-mobile/WordPress-Android/pull/12114 and I have a theory why the ids are null. Since the templates don't assign an id (the image is not really on the site in the media library, nor is it a local one, so it really can't have an id), the processors were choking during their DFS for the local id replacement. The PR referenced above will abort when id is null, which should be safe, as that will not modify the contents for the given block.

develric commented 4 years ago

I was looking into this one, after some code speculation I tried to replicate it. I confirm that following the steps in @designsimply video I can replicate it with 14.9 version, but cannot replicate it anymore with current develop. Hey Sheri, maybe I'm just missing something, but can you confirm this is still an issue? Thanks šŸ™‡

hypest commented 4 years ago

I can replicate it with 14.9 version, but cannot replicate it anymore with current develop

Just to be sure, can you also try with latest production version (v16.0) as well @develric? To check if it is a release version issue or not. Thanks!

develric commented 4 years ago

Hey @hypest , I tried again with released production version v16.0 (for completeness I used this release apk since I'm not reached yet from the 16.0 google play version, but I guess should be the same, correct?). I confirm I cannot reproduce the issue. Would be good if someone else can confirm it so we can decide if this is still an issue or not. Thanks šŸ™‡

mkevins commented 4 years ago

I've tried to reproduce this via the 16.2 release branch apk, and was unable to reproduce it following the described steps. I believe this has been solved, and I think the issue can be closed. I wasn't able to see the sentry data referenced here (404). :wave: :smile: @designsimply , do you know if there is still a working link to the issue?

designsimply commented 3 years ago

I looked but couldn't find a working link! Closing since it was tested several times and no one was able to replicate the bug. šŸ‘