Skip to content

Error loading storage: FormatException due to corrupted serialized state #74

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

Closed
felixwoestmann opened this issue May 1, 2024 · 8 comments

Comments

@felixwoestmann
Copy link

Hello,
we ran into the issue that the serialized state is broken and can't be deserialized. When initializing the Client we are now catching the error, but would like to have an option to delete all stored state to remove the error. Currently it occurs every time when starting the application.

Is there a way to do so?

The following is the data which is not valid Json and therefore couldn't be deserialized. It was from the file analytics-flutter-queue_flushing_plugin.json.

{"queue":[{"anonymousId":"cfe0edd5-2348-47f0-a1e4-6a3ecedf07b9","messageId":"0d9de8ea-c709-4e96-aea4-b66bc51db74a","userId":null,"timestamp":"2024-04-30T13:22:09.965928","context":{"app":{"build":"1","name":"App Name","namespace":"com.app.name","version":"3.40.0"},"device":{"manufacturer":"Google","model":"sdk_gphone64_arm64","name":"emu64a","type":"android"},"library":{"name":"analytics-flutter","version":"1.0.0"},"locale":"en-US","network":{"cellular":false,"wifi":true},"os":{"name":"Android","version":"14"},"screen":{"height":1270,"width":720,"density":2.0},"timezone":"Europe/Ljubljana","instanceId":"5e8546bb-bba3-4ff7-b3b1-f5ab3d42d7a6","traits":{}},"integrations":null,"_metadata":{"bundled":[],"unbundled":["Actions Amplitude"],"bundledIds":[]},"event":"responseReceived","properties":{"screen":"LoginRoute","value":"Success"},"type":"track"},{"anonymousId":"cfe0edd5-2348-47f0-a1e4-6a3ecedf07b9","messageId":"bf9ead8c-29df-4fd2-9b02-71dee4ba5e55","userId":null,"timestamp":"2024-04-30T13:22:09.983209","context":{"app":{"build":"1","name":"App Name","namespace":"com.app.name","version":"3.40.0"},"device":{"manufacturer":"Google","model":"sdk_gphone64_arm64","name":"emu64a","type":"android"},"library":{"name":"analytics-flutter","version":"1.0.0"},"locale":"en-US","network":{"cellular":false,"wifi":true},"os":{"name":"Android","version":"14"},"screen":{"height":1270,"width":720,"density":2.0},"timezone":"Europe/Ljubljana","instanceId":"5e8546bb-bba3-4ff7-b3b1-f5ab3d42d7a6","traits":{}},"integrations":null,"_metadata":{"bundled":[],"unbundled":["Actions Amplitude"],"bundledIds":[]},"name":"/select-hub","properties":{},"type":"screen"},{"anonymousId":"cfe0edd5-2348-47f0-a1e4-6a3ecedf07b9","messageId":"4fda9727-48ac-40cb-856b-c6290526b02b","userId":null,"timestamp":"2024-04-30T13:22:13.209824","context":{"app":{"build":"1","name":"App Name","namespace":"com.app.name","version":"3.40.0"},"device":{"manufacturer":"Google","model":"sdk_gphone64_arm64","name":"emu64a","type":"android"},"library":{"name":"analytics-flutter","version":"1.0.0"},"locale":"en-US","network":{"cellular":false,"wifi":true},"os":{"name":"Android","version":"14"},"screen":{"height":1270,"width":720,"density":2.0},"timezone":"Europe/Ljubljana","instanceId":"5e8546bb-bba3-4ff7-b3b1-f5ab3d42d7a6","traits":{}},"integrations":null,"_metadata":{"bundled":[],"unbundled":["Actions Amplitude"],"bundledIds":[]},"traits":{"hubId":"de-hh-pauli"},"type":"identify"}]}

@edsonjab
Copy link
Contributor

edsonjab commented May 1, 2024

hi @felixwoestmann thank you for your report, we start looking into this.

@QuirijnGB
Copy link

We're experiencing the same

@edsonjab
Copy link
Contributor

edsonjab commented May 14, 2024

hi @felixwoestmann @QuirijnGB could you help me to provide an example how you configure your project? and your Analytics configuration, please, I can't replicate the issue; all works as expected.

@chrisk1123
Copy link

We're experiencing the same

@WuChuanRong
Copy link

We're experiencing the same

Future _initial() async {
if (_initDone) return;
_initDone = true;

final segmentKey = AppConfig.current.segmentKey;

final configuration = Configuration(
  segmentKey,
  trackApplicationLifecycleEvents: false,
  flushPolicies: [
    StartupFlushPolicy(),
    TimerFlushPolicy(3000),
    CountFlushPolicy(10),
  ]
);
analytics = createClient(configuration);

}

@QuirijnGB
Copy link

Config

      var segmentClient = createClient(
        Configuration(
          [KEY],
          trackApplicationLifecycleEvents: true,
          trackDeeplinks: true,
        ),
      );

Some errors in Sentry

Error loading storage: FormatException: Unexpected character (at character 13)
{"queue":[]}anonymousId":"[REDACTED]","messageId"...
FormatException: Unexpected character (at character 621)
...tal","last_name":"[REDACTED]","subscription_plan_name":"Roamer"}}":"Roamer"}}

I actually haven't been able to reliably reproduce it.
Is there a way we can reliably trigger a write to cache?

@cerealexx
Copy link

same here... it's really annoying

@edsonjab
Copy link
Contributor

edsonjab commented Jun 5, 2024

Hi @cerealexx , could you help us to explain how replicate the issue, please?
flutter version, segment version, configuration file of segmentClient

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

No branches or pull requests

7 participants