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

fix(datastore): prevent unhandled exception crashing App rebuilding s… #2549

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Jan 6, 2023

…ync expression

Issue #, if available:

Related: #1816

Description of changes:

There is reported that a unhandled exception causes App to crash on Android while DataStore building sync expression for amplify-android implementation from Dart implementation. I haven't figure out why the latch await would be interrupted, at least we can handle this exception thrown from latch.await() to prevent App from crashing.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@HuiSF HuiSF requested a review from a team as a code owner January 6, 2023 21:01
dnys1
dnys1 previously approved these changes Jan 6, 2023
latch.await()
try {
latch.await()
} catch (e: InterruptedException) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the only exception we care about? Should this be catch (e: Exception)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea await throws only InterruptedException.

Jordan-Nelson
Jordan-Nelson previously approved these changes Jan 6, 2023
@HuiSF HuiSF dismissed stale reviews from Jordan-Nelson and dnys1 via 054ea68 January 6, 2023 22:23
@HuiSF HuiSF force-pushed the fix/ds-unhandled-exception-crash branch from 904c015 to 054ea68 Compare January 6, 2023 22:23
@HuiSF HuiSF force-pushed the fix/ds-unhandled-exception-crash branch from 054ea68 to 6464555 Compare January 6, 2023 22:45
@codecov-commenter
Copy link

codecov-commenter commented Jan 6, 2023

Codecov Report

Merging #2549 (6464555) into main (51f5e56) will increase coverage by 0.30%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2549      +/-   ##
==========================================
+ Coverage   45.70%   46.01%   +0.30%     
==========================================
  Files         360      364       +4     
  Lines       10926    11028     +102     
==========================================
+ Hits         4994     5074      +80     
- Misses       5932     5954      +22     
Flag Coverage Δ
android-unit-tests ∅ <ø> (∅)
flutter-unit-tests 35.67% <ø> (ø)
ios-unit-tests 89.16% <ø> (-0.54%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...e/ios/unit_tests/MockAnalyticsCategoryPlugin.swift 15.38% <0.00%> (ø)
...y_flutter_ios/example/ios/Runner/AppDelegate.swift 0.00% <0.00%> (ø)
...ios/example/ios/unit_tests/AtomicResultTests.swift 87.75% <0.00%> (ø)
.../ios/unit_tests/amplify_flutter_exampleTests.swift 94.59% <0.00%> (ø)

@HuiSF HuiSF enabled auto-merge January 7, 2023 00:09
@HuiSF HuiSF merged commit 8fb11ed into main Jan 9, 2023
@HuiSF HuiSF deleted the fix/ds-unhandled-exception-crash branch January 9, 2023 19:31
dnys1 pushed a commit to dnys1/amplify-flutter that referenced this pull request Jan 11, 2023
## Fixes
- fix(datastore): prevent unhandled exception crashing App rebuilding sync expression (aws-amplify#2549)
- fix(datastore): Upgrading from Datastore 0.6.1 to 0.6.8 causes Android app to crash (aws-amplify#2556)

## Cherry Picks
- 160674d
- 7121ebc
- 957d6b4
- 5ec55b9
- 33df283
- 5ec023b
- 51f5e56
- fab55ae
- 6bd4182
- 6464555
- 2a7caae
@dnys1 dnys1 mentioned this pull request Jan 11, 2023
dnys1 pushed a commit to dnys1/amplify-flutter that referenced this pull request Jan 11, 2023
## Fixes
- fix(datastore): prevent unhandled exception crashing App rebuilding sync expression (aws-amplify#2549)
- fix(datastore): Upgrading from Datastore 0.6.1 to 0.6.8 causes Android app to crash (aws-amplify#2556)

## Cherry Picks
- 160674d
- 7121ebc
- 957d6b4
- 5ec55b9
- 33df283
- 5ec023b
- 51f5e56
- fab55ae
- 6bd4182
- 6464555
- 2a7caae
dnys1 pushed a commit to dnys1/amplify-flutter that referenced this pull request Jan 12, 2023
- fix(datastore): prevent unhandled exception crashing App rebuilding sync expression (aws-amplify#2549)
- fix(datastore): Upgrading from Datastore 0.6.1 to 0.6.8 causes Android app to crash (aws-amplify#2556)
- fix(api): model helpers use targetNames in schemas with CPK enabled (aws-amplify#2559)

- 160674d
- 7121ebc
- 957d6b4
- 5ec55b9
- 33df283
- 5ec023b
- 51f5e56
- fab55ae
- 6bd4182
- 6464555
- 2a7caae
- 809190c
dnys1 pushed a commit that referenced this pull request Jan 12, 2023
- fix(datastore): prevent unhandled exception crashing App rebuilding sync expression (#2549)
- fix(datastore): Upgrading from Datastore 0.6.1 to 0.6.8 causes Android app to crash (#2556)
- fix(api): model helpers use targetNames in schemas with CPK enabled (#2559)

- 160674d
- 7121ebc
- 957d6b4
- 5ec55b9
- 33df283
- 5ec023b
- 51f5e56
- fab55ae
- 6bd4182
- 6464555
- 2a7caae
- 809190c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants