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

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

Closed
gglobalstep opened this issue May 21, 2020 · 12 comments

Comments

@gglobalstep
Copy link

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

Scenario 1 (PUBLISHED TAB):
8. Note: while image is uploading, Tap on "PUBLISH" option.
9. Tap on "PUBLISH NOW" option when "Ready to Publish?" popup appears .
10. Note on "PUBLISHED" tab->Page with "Uploading media.." will get added to the list.
11. Tap on create a new page icon on "DRAFTS" tab.
12. Repeat steps 6,7 from above and 8,9 from Published scenario.
13. Note on "PUBLISHED" tab->Page with "Uploading media.." will get added to the list.
14. 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):
8. Tap back arrow icon
9. Note that Page with "Uploading media.." will get added in the DRAFTS tab list.Tap on create a new page icon.
10. Repeat steps 6,7 from above and 8 from drafts scenario.
11. Note that Page with "Queued page.." will get added in the DRAFTS tab list
14. 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
Copy link
Contributor

Screenshots from the attachment:

#2289_Scenario 1 #2289_Scenario2

@designsimply
Copy link
Contributor

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 designsimply transferred this issue from wordpress-mobile/gutenberg-mobile May 22, 2020
@designsimply
Copy link
Contributor

designsimply commented May 22, 2020

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 #11992 actually this one WORDPRESS-ANDROID-C15. h/t @ashiagr for pointing me in the right direction!

@khaykov
Copy link
Member

khaykov commented Jun 4, 2020

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
Copy link
Contributor

hypest commented Jun 5, 2020

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
Copy link
Contributor

mkevins commented Jun 5, 2020

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
Copy link
Contributor

mkevins commented Jun 5, 2020

Awesome job on the details for reproducing @gglobalstep and @khaykov ! I've drafted a PR for the NPEs here: #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.

@khaykov khaykov removed their assignment Jun 8, 2020
@mzorz mzorz self-assigned this Aug 28, 2020
@mzorz mzorz removed their assignment Aug 29, 2020
@develric
Copy link
Contributor

develric commented Nov 2, 2020

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
Copy link
Contributor

hypest commented Nov 3, 2020

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
Copy link
Contributor

develric commented Nov 3, 2020

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
Copy link
Contributor

mkevins commented Nov 30, 2020

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). 👋 😄 @designsimply , do you know if there is still a working link to the issue?

@designsimply
Copy link
Contributor

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

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

No branches or pull requests

8 participants