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

Flutter SDK init falls into loop when race condition happens during the initialization. #311

Closed
klim-branch opened this issue Apr 22, 2024 · 7 comments
Labels
bug Something isn't working Waiting for Test Waiting for test results after release

Comments

@klim-branch
Copy link

Hi, this is Kun from the Branch Solutions Integration Engineering team.

The Flutter SDK’s initialization is not handled correctly when it gets into a race condition by initializing other 3rd party services with Firebase Messaging Services (default push notification package)

Reproduction step

  • Implement a Firebase Messaging Services to the application.
  • From the Service, start an instance of Notification service (3rd party) and use Branch to receive Branch link data.

We indeed do have a full code example with the reference given from the client side.
please send out the email to kunho.lim@branch.io.

Initialization:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterBranchSdk.init(useTestKey: false, enableLogging: true, disableTracking: false);
  WidgetsFlutterBinding.ensureInitialized();

Observation

image

Where you can see that the initialization continuously loop with the message: BranchReferralInitListener - error: Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true.

From the UX/UI side, since the application is not initialized, it is showing a blank black screen and not loading anything from the application.

https://drive.google.com/file/d/1l0WkH82lH9DCyIEKTW7OgQOO2HLCNKfs/view?usp=sharing

deally, when the Branch init fails, it should just retry for a certain amount of time and return. However, it seems like in this current situation, it is not returning and constantly try to initialize the SDK.

Please check if we are enabling any other async initialization or any initialization error handling for Flutter SDK.

@RodrigoSMarques
Copy link
Owner

Hi @klim-branch

Let me know which version of the package is being used.

Issue #301 reported similar behavior and was resolved in version 7.2.0

@klim-branch
Copy link
Author

Hi @RodrigoSMarques

thank you for the confirmation,
I can confirm that the client is using ^7.1.0 version of the SDK.

flutter_branch_sdk: ^7.1.0

Perhaps I will let them know to use version above 7.2.0.

@klim-branch
Copy link
Author

Hi @RodrigoSMarques
The client tried with the 7.3.0 version of the SDK and the issue persists.

I've also tried with the sample application given by the client, upgraded our SDK, resolved all of the flutter dependencies to match js: ^0.7.1, and was able to reproduce the issue from my end.

The change that I made from the sample app is the following:

js: ^0.7.1
flutter_branch_sdk: ^7.1.0 -> flutter_branch_sdk: ^7.3.0
Run flutter pub upgrade --major-versions

Could you please kindly take a look into it?

@RodrigoSMarques
Copy link
Owner

hi @klim-branch

I have added Firebase Cloud Messaging into an application.

I sent the notification, opened the application from the notification and was unable to reproduce the problem.

I need more details to be provided, such as the list of packages used by the application to try to create the same scenario.

@klim-branch
Copy link
Author

Hi @RodrigoSMarques thank you for looking into the issue!
So to confirm, it seems like the issue is not coming from using Firebase notification package.

Could you please look into the sample code that was shared to you?
I will follow up with you from the separate email chain to further discuss on this.

@RodrigoSMarques
Copy link
Owner

@klim-branch

Version 8.0.0 released.

Take the tests and report the results.

@RodrigoSMarques RodrigoSMarques added the Waiting for Test Waiting for test results after release label May 20, 2024
@klim-branch
Copy link
Author

Thank you very much for the support here!
Confirming the issue has been resolved with the usage of the SDK version 8.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Waiting for Test Waiting for test results after release
Projects
None yet
Development

No branches or pull requests

2 participants