Skip to content

Stale symbol table child can replace a newer root table #1654

Description

@Dongnyoung

Description

A stale child symbol table can replace a newer, larger root symbol table when parsers are closed out of creation order.

For example, if one parser is created and reads one field name, and another parser created from the same JsonFactory reads additional field names and closes first, the root symbol table is updated with the larger child table. When the older parser closes later, however, its smaller child table can replace the newer root table.

As a result, the shared symbol table can lose symbols learned by a newer parser.

Reproduction

The issue applies to both byte-backed and char-backed parsers:

  1. Create parser A from a shared JsonFactory.
  2. Read one field name with parser A.
  3. Create parser B from the same factory.
  4. Read additional field names with parser B.
  5. Close parser B.
  6. Close parser A.

After parser B closes, the root symbol table contains the larger symbol set. After parser A closes, the root table can regress to parser A's stale, smaller child table.

Expected behavior

An older child symbol table should not replace a newer, larger root table produced by another child.

Actual behavior

The older child can merge after the newer child and replace the root table with its stale state.

Notes

This affects both CharsToNameCanonicalizer and ByteQuadsCanonicalizer.

This is separate from the intentional reset behavior for oversized symbol tables. The issue here is specifically an older child state replacing a newer root state during out-of-order parser release.

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