apache / apache/parquet-java

Thread safety bug in CodecFactory

Ouverte
#2,669 9 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Component: Java Component: Parquet Priority: Major Type: bug
Langage dominant
Java
Étoiles
3.1k
Forks
1.6k
Merge moyen
3 j 12 h
PR mergées (30 j)
33

Description

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.*

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez dans org.apache.parquet.hadoop.CodecFactory, en particulier avec getCompressor et getDecompressor, et suivez la manière dont les maps BytesCompressor et BytesDecompressor interagissent avec Apache Commons pool. La tâche est terminée lorsque les instances de compressor et de decompressor ne sont plus mises en cache comme instances uniques partagées, afin que des appelants GZIP concurrents ne puissent pas partager le BuiltInGzipCompressor non thread-safe.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
backend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.