Skip to content

DefaultValuesWriterFactory uses thread-unsafe static singletons, causing cross-writer allocator contamination #3497

@arouel

Description

@arouel

Describe the bug, including details regarding any error messages, version, and platform.

DefaultValuesWriterFactory delegates to static singleton instances of DefaultV1ValuesWriterFactory / DefaultV2ValuesWriterFactory. Both singletons store a mutable parquetProperties field that is overwritten on every initialize() call. When multiple ParquetProperties instances exist concurrently in the same JVM, the last caller to initialize() wins, causing other writers to silently use a foreign ParquetProperties and its ByteBufferAllocator.

To Reproduce

  1. Create two ParquetProperties instances, each with a different ByteBufferAllocator
  2. Use them concurrently from different threads to write Parquet files
  3. Close the writer whose allocator "leaked" into the other's factory
  4. The other writer crashes on the next buffer write

Expected behavior

Each ParquetProperties instance should use its own allocator exclusively. The ValuesWriterFactory should not share mutable state across independent writer instances.

Version

1.17.0 (also affects all prior versions with this code pattern)

Component(s)

Core

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions