Skip to content

LateInitializationError in unified_analytics on beta/3.21.0-1.0.pre.2 #146153

Description

@christopherfujino

On beta/3.21.0-1.0.pre.2

LateInitializationError: Field 'userProperty' has not been initialized.
at AnalyticsImpl.userProperty(analytics.dart)
at AnalyticsImpl.send(analytics.dart:613)
at ErrorHandler.log(error_handler.dart:29)
at Session._refreshSessionData(session.dart:102)
at new Session(session.dart:37)
at new AnalyticsImpl(analytics.dart:429)
at new Analytics(analytics.dart:87)
at getAnalytics(unified_analytics.dart:51)
at runInContext.<anonymous closure>(context_runner.dart:92)
at AppContext._generateIfNecessary.<anonymous closure>(context.dart:107)
at _LinkedHashMapMixin.putIfAbsent(compact_hash.dart:543)
at AppContext._generateIfNecessary(context.dart:95)
at AppContext.get(context.dart:124)
at AppContext.get(context.dart:122)
at AppContext.get(context.dart:122)
at analytics(globals.dart:98)
at FlutterCommand.analytics(flutter_command.dart:236)
at FlutterCommand.verifyThenRunCommand(flutter_command.dart:1755)
at <asynchronous gap>(async)
at FlutterCommand.run.<anonymous closure>(flutter_command.dart:1394)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:153)
at <asynchronous gap>(async)
at CommandRunner.runCommand(command_runner.dart:212)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand.<anonymous closure>(flutter_command_runner.dart:360)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:153)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand(flutter_command_runner.dart:300)
at <asynchronous gap>(async)
at run.<anonymous closure>.<anonymous closure>(runner.dart:119)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:153)
at <asynchronous gap>(async)
at main(executable.dart:94)
at <asynchronous gap>(async)

Activity

  1. christopherfujino commented on Apr 2, 2024

    @christopherfujino
    ContributorAuthor

    @eliasyishak please verify that:

    1. we did NOT cherry pick the fix to beta (if we did, then we should know why the fix did not work); and
    2. that the next beta branch does NOT have this regression (you may have to ask the release team what this branch is)
  2. eliasyishak commented on Apr 2, 2024

    @eliasyishak
    Contributor

    Looks like this the version for the beta candidate for this package is 5.8.4 which is greater than the fix we made in stable at 5.8.0+1 which tells me that the fix should be included now

    However, 5.8.4 still has late variables being used inside the source code.. to remove the possibility of this error coming up, I think we should CP an update to bump this version to 6.0.0. Is that allowed for the beta channel?

    Scratch that, after reading the changelog, i see that version 5.8.5 is actually what fixed the LateInitialization bug. I think the best thing we can do is CP into beta the latest 6.0.0 package that removes all of the late variables + the errors we encountered because we removed a key from the persisted session json file

  3. christopherfujino commented on Apr 2, 2024

    @christopherfujino
    ContributorAuthor

    Scratch that, after reading the changelog, i see that version 5.8.5 is actually what fixed the LateInitialization bug. I think the best thing we can do is CP into beta the latest 6.0.0 package that removes all of the late variables + the errors we encountered because we removed a key from the persisted session json file

    1. we cannot just bump a dependency in a Flutter release to latest, especially not across a major version change (i.e. 5.8.5 -> 6.0.0). We would need to make a special hotfix release of unified_analytics.
    2. It looks like the upcoming beta release is branch flutter-3.22-candidate.0: https://github.com/flutter/engine/pull/51851/files
  4. eliasyishak commented on Apr 3, 2024

    @eliasyishak
    Contributor

    @christopherfujino, I see, to hotfix this then, I think we should remove the error handler functionality altogether since that is what causes the error when it tries to send events on start up.

    That way we dont introduce new code refactors from 6.0.0 while we still remove the late initialization error.

  5. eliasyishak commented on Apr 3, 2024

    @eliasyishak
    Contributor

    2. It looks like the upcoming beta release is branch flutter-3.22-candidate.0: https://github.com/flutter/engine/pull/51851/files

    Oh wait, when i look at the branch flutter-3.22-candidate.0, i see that we have version 5.8.8 which does fix the late initialization bug. How do we find the correct branch again? My workflow was:

    1. Go to flutter/flutter main repo
    2. Look for beta branch which took me to: https://github.com/flutter/flutter/blob/beta
    3. Find the candidate release within: https://github.com/flutter/flutter/blob/beta/bin/internal/release-candidate-branch.version

    From step 3, that pointed to: flutter-3.21-candidate.0.

  6. christopherfujino commented on Apr 3, 2024

    @christopherfujino
    ContributorAuthor

    Oh wait, when i look at the branch flutter-3.22-candidate.0, i see that we have version 5.8.8 which does fix the late initialization bug. How do we find the correct branch again? My workflow was:

    1. Go to flutter/flutter main repo
    2. Look for beta branch which took me to: https://github.com/flutter/flutter/blob/beta
    3. Find the candidate release within: https://github.com/flutter/flutter/blob/beta/bin/internal/release-candidate-branch.version

    From step 3, that pointed to: flutter-3.21-candidate.0.

    This is the correct method to find the current beta version. However, we expect a new beta (based on 3.22) to be shipped today, so we would not actually accept a cherry pick to the 3.21 branch.

  7. eliasyishak commented on Apr 3, 2024

    @eliasyishak
    Contributor

    I see, so we may be okay then, I am going to download package:unified_analytics 5.8.8 and see if i can reproduce this late initialization error.

  8. andrewkolos commented on Apr 29, 2024

    @andrewkolos
    Contributor

    Assuming this has since been resolved.

  9. github-actions commented on May 13, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions