Skip to content

Some logs are uploaded with corrupted JSON/inline garbage data #320

Closed
@erichoracek

Description

@erichoracek

Describe the bug
We are encountering an issue where the Segment SDK is uploading malformed JSON.

We believe approximately 2.5-5% of uploads are exhibiting this issue, and we see it across a large range of our app versions.

To Reproduce
We haven't been able to reproduce this locally in the debugger, but have many logs and examples from production.

Expected behavior
The SDK should not upload malformed JSON.

Screenshots
N/A

Platform (please complete the following information):

  • Library Version in use: 1.4.7 to 1.5.5
  • Platform being tested: iOS
  • Integrations in use: None

Additional context
Here are some examples:

Batch elements with garbage data

{
    "batch": [
        { "redacted", "redacted" },
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,
        { "redacted", "redacted" },
    ],
    "sentAt": "redacted",
    "writeKey": "redacted"
}

Multiple concatenated batches in a single batch

{
    "batch": [
        { "redacted", "redacted" },
        { "redacted", "redacted" },
        { "redacted", "redacted" },
    ],
    "sentAt": "redacted",
    "writeKey": "redacted"
},
{ "redacted", "redacted" },
{ "redacted", "redacted" },
],
"sentAt": "redacted",
"writeKey": "redacted"
}

Empty batch

],
"sentAt": "redacted",
"writeKey": "redacted"
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions