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

Fragile interface when scan API call throws exception #628

Closed
monsieurtanuki opened this issue Oct 21, 2021 · 2 comments · Fixed by #630
Closed

Fragile interface when scan API call throws exception #628

monsieurtanuki opened this issue Oct 21, 2021 · 2 comments · Fixed by #630

Comments

@monsieurtanuki
Copy link
Contributor

(it happened this morning: does it show on Sentry?)

Describe the bug
A couple of bugs this morning:

  1. Scanning a barcode => trying to find the given barcode in the API => endless progress loop, while there were CERTIFICATE_VERIFY_FAILED messages in the logs
  2. Keyword search ("nutella") => almost immediate screen error about CERTIFICATE_VERIFY_FAILED

To Reproduce
Steps to reproduce the behavior:

Bug 1 with barcode scan:

  1. Scan a new barcode
  2. Automatically, the API is called in order to find the barcode's product data
  3. The access to the API does not work, which causes an endless progress widget

Bug 2 with keyword search:

  1. Type in a keyword and click on the "search" button
  2. A smoothie error screen is displayed about CERTIFICATE_VERIFY_FAILED

Expected behavior
Bug 1:

  • an error message would be displayed instead of an endless progress widget
  • in case the product already exists in the local db, it would be displayed with a snackbar warning ("old data")

Bug 2:

  • in case the query already exists in the local db, it would be displayed with a snackbar warning ("old data")

Screenshots
Bug 1:
Screenshot_2021-10-21-09-46-48

Bug 2:
Screenshot_2021-10-21-09-55-07

Logs

E/flutter ( 5911): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error: 
E/flutter ( 5911): 	CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359))
E/flutter ( 5911): #0      _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:101:69)
E/flutter ( 5911): #1      _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25)
E/flutter ( 5911): #2      _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54)
E/flutter ( 5911): #3      _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19)
E/flutter ( 5911): <asynchronous suspension>
E/flutter ( 5911): 
W/art     ( 5911): Suspending all threads took: 6.738ms
I/art     ( 5911): Background partial concurrent mark sweep GC freed 3610(205KB) AllocSpace objects, 13(2MB) LOS objects, 24% free, 7MB/10MB, paused 7.919ms total 42.522ms
D/Sentry  ( 5911): onEvent fired for EnvelopeFileObserver with event type 8 on path: /data/data/org.openfoodfacts.app/cache/sentry/outbox for file 1d9ee008-0461-45f1-9be6-dfbd70a896f9.
D/Sentry  ( 5911): Processing Envelope with 1 item(s)
D/Sentry  ( 5911): Capturing event: 30b361c66b2d4ed48321e13473afd694
I/Sentry  ( 5911): No permission (ACCESS_NETWORK_STATE) to check network status.
I/Sentry  ( 5911): No permission (ACCESS_NETWORK_STATE) to check network status.
D/Sentry  ( 5911): Captured Envelope is already cached
D/Sentry  ( 5911): Item 1 is being captured.
I/Sentry  ( 5911): No permission (ACCESS_NETWORK_STATE) to check network status.
I/System.out( 5911): (HTTPLog)-Static: isSBSettingEnabled false
@stephanegigandet
Copy link
Contributor

(it happened this morning: does it show on Sentry?)

@monsieurtanuki It doesn't happen for me, does it still happen for you?

If it does, maybe your phone is affected by this: openfoodfacts/openfoodfacts-infrastructure#65

@monsieurtanuki
Copy link
Contributor Author

@stephanegigandet Good point: I tested with my old smartphone.
Now I've just tested with an Android emulator, and everything is fine on the emulator.

That said, the current issue, beyond the alarming CERTIFICATE_VERIFY_FAILED message, was also about "what do we do when something ugly happens with the API?".
For instance, I still think an error message should be displayed immediately instead of an endless progress widget.
I can work on that. I won't even have to fake an https error on my smartphone, lucky me! ;)

monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Oct 21, 2021
…el product card

New file:
* `smooth_product_card_error.dart`: Product Card when an exception is caught

Impacted files:
* `continuous_scan_model.dart`: new value `ScannedProductState.ERROR`, used when an exception is caught during API call
* `smooth_product_carousel.dart`: handling the `ScannedProductState.ERROR` case
@monsieurtanuki monsieurtanuki changed the title Fragile interface when CERTIFICATE_VERIFY_FAILED Fragile interface when scan API call throws exception Oct 21, 2021
monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Oct 24, 2021
… over internet errors

New file:
* `fetched_product.dart`: combo of Product and its fetch status

Impacted files:
* `app_en.arb`: added translations for "internet error" and "canceled by user"
* `barcode_product_query.dart`: now using `FetchedProduct` instead of `Product`
* `choose_page.dart`: now using `FetchedProduct` instead of `Product`
* `continuous_scan_model.dart`: now using `FetchedProduct` instead of `Product`
* `new_product_page.dart`: now using `FetchedProduct` instead of `Product`
* `product_dialog_helper.dart`: now using `FetchedProduct` instead of `Product`
* `product_page.dart`: now using `FetchedProduct` instead of `Product`
* `smooth_product_card_error.dart`: added an explicit message
monsieurtanuki added a commit that referenced this issue Oct 26, 2021
…t errors (#630)

New files:
* `fetched_product.dart`: combo of Product and its fetch status
* `smooth_product_card_error.dart`: Product Card when an exception is caught

Impacted files:
* `app_en.arb`: added translations for "internet error" and "canceled by user"
* `barcode_product_query.dart`: now using `FetchedProduct` instead of `Product`
* `choose_page.dart`: now using `FetchedProduct` instead of `Product`
* `continuous_scan_model.dart`: new value `ScannedProductState.ERROR`, used when an exception is caught during API call; now using `FetchedProduct` instead of `Product`
* `new_product_page.dart`: now using `FetchedProduct` instead of `Product`
* `product_dialog_helper.dart`: now using `FetchedProduct` instead of `Product`
* `product_page.dart`: now using `FetchedProduct` instead of `Product`
* `smooth_product_card_error.dart`: added an explicit message
* `smooth_product_carousel.dart`: handling the `ScannedProductState.ERROR` case
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 a pull request may close this issue.

2 participants