Skip to content

Fix crash in UploadStarter on Samsung devices with Android 5#10877

Closed
malinajirka wants to merge 329 commits intorelease/13.7from
issue/10872-fix-upload-starter
Closed

Fix crash in UploadStarter on Samsung devices with Android 5#10877
malinajirka wants to merge 329 commits intorelease/13.7from
issue/10872-fix-upload-starter

Conversation

@malinajirka
Copy link
Copy Markdown
Contributor

@malinajirka malinajirka commented Nov 29, 2019

Fixes #10827

Fixes a crash on Samsung devices running Android 5. The app is crashing because it can't find _state variable in the runtime. However, we don't directly use this variable in our code. As it turned out the variable is used in Mutex.kt. This PR simply removes the usage of Mutex from our codebase and replaces it with @Synchronized.

More info about why the app is crashing can be find in @jd-alexander comment.

To test:
I don't have a Samsung phone running Android 5. But we should at least verify it still works as expected on other phones.

  1. Turn off the internet connection
  2. Create a post
  3. Publish it
  4. Turn on internet connection + pull to refresh
  5. Make sure the post gets uploaded

PR submission checklist:

  • I have considered adding unit tests where possible.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Thank you @jd-alexander for the initial investigation which really helped me fix this issue!

@jkmassel We might want to consider merging this change as hotfix - wdyt? It crashed 3.6k times to 1.2k users in the last 90 days. I'm a bit worried that it might not work on Samsung devices running Android 5 at all - I haven't checked the stats though. I believe the change is very safe.

@malinajirka malinajirka added this to the 13.8 milestone Nov 29, 2019
@malinajirka malinajirka requested a review from shiki November 29, 2019 14:39
@peril-wordpress-mobile
Copy link
Copy Markdown

You can test the changes on this Pull Request by downloading the APK here.

Copy link
Copy Markdown
Contributor

@shiki shiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

  • Verified that all sites' posts are still uploaded on startup
  • Tested given testing steps

@shiki shiki changed the base branch from develop to release/13.7 November 29, 2019 21:02
@shiki shiki changed the base branch from release/13.7 to develop November 29, 2019 21:03
@jkmassel jkmassel changed the base branch from develop to release/13.7 November 29, 2019 21:35
@peril-wordpress-mobile
Copy link
Copy Markdown

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.
Messages
📖

This PR contains changes in the subtree libs/login/. It is your responsibility to ensure these changes are merged back into wordpress-mobile/WordPress-Login-Flow-Android. Follow these handy steps!
WARNING: Make sure your git version is 2.19.x or lower - there is currently a bug in later versions that will corrupt the subtree history!

  1. cd WordPress-Android
  2. git checkout issue/10872-fix-upload-starter
  3. git subtree push --prefix=libs/login/ https://github.com/wordpress-mobile/WordPress-Login-Flow-Android.git merge/WordPress-Android/10877
  4. Browse to https://github.com/wordpress-mobile/WordPress-Login-Flow-Android/pull/new/merge/WordPress-Android/10877 and open a new PR.

Generated by 🚫 dangerJS

@jd-alexander
Copy link
Copy Markdown
Contributor

jd-alexander commented Nov 29, 2019

This PR and the referenced issue can be closed right @shiki?

@shiki
Copy link
Copy Markdown
Contributor

shiki commented Nov 29, 2019

Yes! Thank you, @jd-alexander.

Closing this in favor of #10878 which will be released with release/13.7.

@shiki shiki closed this Nov 29, 2019
ParaskP7 added a commit that referenced this pull request Sep 27, 2022
Warning Messages: "@synchronized annotation is not applicable to suspend
functions and lambdas"

It turns out that this '@synchronized' solution were already replacing
the previous (d5b9948) 'Mutex'
solution, and this, due to the fact that the existing (back then)
'Mutex' solution were causing crashes on Samsung devices running
Android 5 (API Level 21). However, this repo, and thus both, the
WordPress and Jetpack apps, are no longer supporting these devices as
the current 'minSdkVersion' is '24' (Android 7). Thus, this
'@synchronized' annotation can be now safely removed and the
'Mutex' solution reverting back.

For more info see:
- Fix crash in UploadStarter on Samsung devices with Android 5 #10877
(Introduced In): https://github.com/wordpress-mobile/WordPress-Android/
pull/10877/
- ExceptionInInitializerError #10827 (Crash Report):
#10827
- NoSuchFieldException with AtomicReferenceFieldUpdater on Samsung
Android 5.0.x devices #490 (Coroutines Issue):
Kotlin/kotlinx.coroutines#490
@jkmassel jkmassel deleted the issue/10872-fix-upload-starter branch October 17, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.