-
Notifications
You must be signed in to change notification settings - Fork 137
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
Fix crash when Exit event is fired multiple times #13281
Open
JorgeMucientes
wants to merge
3
commits into
trunk
Choose a base branch
from
issue/13226-fix-crash-on-exit
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exit event could potentially be fired more than once which will make the app crash because it will attempt to navigate back more than once leading to "IllegalStateException FragmentManager is already executing transactions"
JorgeMucientes
added
type: crash
The worst kind of bug.
feature: product details
Related to adding or editing products, includes product settings.
labels
Jan 10, 2025
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## trunk #13281 +/- ##
============================================
- Coverage 40.79% 40.79% -0.01%
Complexity 6411 6411
============================================
Files 1353 1353
Lines 77679 77679
Branches 10692 10692
============================================
- Hits 31690 31689 -1
- Misses 43182 43183 +1
Partials 2807 2807 ☔ View full report in Codecov by Sentry. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature: product details
Related to adding or editing products, includes product settings.
type: crash
The worst kind of bug.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exit event could potentially be fired more than once, which will make the app crash because it will attempt to navigate back more than once, leading to "IllegalStateException FragmentManager is already executing transactions"
Closes: #13226
Closes: #13289
Description
Tentative fix for crash:
And for the crash:
Which has a similar stack trace.
I spent some time trying to replicate the crash but I was unable to. My hypothesis is that the
Exit
event is triggered simultaneously fromVariationDetailViewModel
when the user clicks the back button and whenloadVariation
function fails to load the variation and automatically runs:triggerEvent(Event.Exit)
. I tried using APIFaker to make different api calls fail when opening variation detail but wasn't able to reproduce the race condition where 2 Exit events are fired at once.The proposed solution is to basically make sure we unsubscribe from LiveData as soon as the first
Exit
event is fired, so that any subsequent call totriggerEvent(Event.Exit)
will be ignored.Testing information
Open a product with variations and check that everything works as expected:
The tests that have been performed
The above
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: