Skip to content

Intermittent issue decoding union types due to concurrency issues and mutating shared state #299

@passuied

Description

@passuied

Description

  • We have observed intermittent issues when calling NativeFromBinary() on union types.
  • After some investigations, we identified that a shared resource cr.allowedTypes was sorted and mutated, therefore causing the issue.

Repro steps:

  • Given a codec created as NewCodecForStandardJSONFull([ "null", "long"])

    • When calling first codec.NativeFromTextual() with a long (e.g. codec.NativeFromTextual([]byte("1")))
    • And calling second codec.BinaryFromTextual() with a long value (e.g. codec.NativeFromBinary([]byte{0x02, 0x06}))
  • Expected:
    native object is map[string]interface{}["long", 3]

  • Actual:
    native object is `map[string]interface{}["null", 3]

Metadata

Metadata

Assignees

No one assigned

    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