Thread safety bug in CodecFactory
- Ngôn ngữ chính
- Java
- Star
- 3.1k
- Fork
- 1.6k
- Merge trung bình
- 3 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 33
Mô tả
The code for returning Compressor objects to the caller goes to some lengths to achieve thread safety, including keeping Codec objects in an Apache Commons pool that has thread-safe borrow semantics. This is all undone by the BytesCompressor and BytesDecompressor Maps in org.apache.parquet.hadoop.CodecFactory which end up caching single compressor and decompressor instances due to code in CodecFactory@getCompressor and CodecFactory@getDecompressor. When the caller runs multiple threads, those threads end up sharing compressor and decompressor instances.
For compressors based on Xerial Snappy this bug has no effect because that library is itself thread safe. But when BuiltInGzipCompressor from Hadoop is selected for the CompressionCodecName.GZIP case, serious problems ensue. That class is not thread safe and sharing one instance of it between threads produces both silent data corruption and JVM crashes.
To fix this situation, parquet-mr should stop caching single compressor and decompressor instances.
**Reporter**: [James Turton](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=dzamo)
#### Related issues:
- [Parquet CodecFactory thread safety bug](https://issues.apache.org/jira/browse/DRILL-8139) (fixes)
**Note**: *This issue was originally created as [PARQUET-2126](https://issues.apache.org/jira/browse/PARQUET-2126). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu trong org.apache.parquet.hadoop.CodecFactory, đặc biệt là getCompressor và getDecompressor, rồi theo dõi cách các map BytesCompressor và BytesDecompressor tương tác với Apache Commons pool. Hoàn thành có nghĩa là các instance compressor và decompressor không còn được cache dưới dạng các instance đơn lẻ dùng chung, để các trình gọi GZIP đồng thời không thể dùng chung BuiltInGzipCompressor không an toàn với luồng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 42/100