Skip to content

Concurrent calls to one DocumentConverter race on shared parser state#80

Merged
SimonCropp merged 1 commit intomainfrom
Concurrent-calls-to-one-DocumentConverter-race-on-shared-parser-state
Apr 13, 2026
Merged

Concurrent calls to one DocumentConverter race on shared parser state#80
SimonCropp merged 1 commit intomainfrom
Concurrent-calls-to-one-DocumentConverter-race-on-shared-parser-state

Conversation

@SimonCropp
Copy link
Copy Markdown
Owner

DocumentConverter held a single DocumentParser instance field, but DocumentParser carries mutable fields it overwrites during Parse (theme colors, numbering tables, table style borders, default spacing). Two threads calling ConvertToImageData on the same converter would clobber
each other's parse state, producing inconsistent output for the same input.

Allocate a fresh DocumentParser per Parse call. Add a release-only regression test that interleaves two distinct inputs through one shared converter and asserts byte-identical output against a sequential baseline.

  DocumentConverter held a single DocumentParser instance field, but DocumentParser carries mutable fields it overwrites during Parse (theme colors, numbering tables, table style borders, default spacing). Two threads calling ConvertToImageData on the same converter would clobber
  each other's parse state, producing inconsistent output for the same input.

  Allocate a fresh DocumentParser per Parse call. Add a release-only regression test that interleaves two distinct inputs through one shared converter and asserts byte-identical output against a sequential baseline.
@SimonCropp SimonCropp added this to the 0.4.1 milestone Apr 13, 2026
@SimonCropp SimonCropp merged commit 5957b17 into main Apr 13, 2026
4 of 6 checks passed
@SimonCropp SimonCropp deleted the Concurrent-calls-to-one-DocumentConverter-race-on-shared-parser-state branch April 13, 2026 23:46
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

Successfully merging this pull request may close these issues.

1 participant