ClickHouse / ClickHouse/clickhouse-java

DataTypeConverter usage has potential thread-safety issues

オープン
#2,728 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug client-api-v2
主要言語
Java
スター
1.6k
フォーク
636
平均マージ
2日 23時間
マージ済み PR(30日)
29

説明

## Description

_This is not an explicit bug report in the sense that I haven't experienced a problem (yet?), it is just something I bumped into while browsing the code_.

`DataTypeConverter` has a [javadoc comment stating that it is not thread safe](https://github.com/ClickHouse/clickhouse-java/blob/main/client-v2/src/main/java/com/clickhouse/client/api/internal/DataTypeConverter.java#L25). For what it's worth, I have also confirmed thread safety problems because I ended up using the `DataTypeConverter.INSTANCE` in production (before I realised that it was labelled as non thread safe) which caused some bugs.

After fixing the bugs in my project, I was curious about the fact that a static singleton `DataTypeConverter.INSTANCE` was even declared in the `clickhouse-java` repo (why have a singleton instance if it is not thread safe, in an otherwise thread safe library?). Of course this class is in a package named `internal`, so it's not really my business... :) Still, I did notice that `DataTypeConverter.INSTANCE` is used in [two](https://github.com/ClickHouse/clickhouse-java/blob/8da0b0c9aa7995b9fa839b56861a28047f71076a/client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/MapBackedRecord.java#L48) [places](https://github.com/ClickHouse/clickhouse-java/blob/8da0b0c9aa7995b9fa839b56861a28047f71076a/client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/AbstractBinaryFormatReader.java#L90) which makes me wonder if it could be the source of (other / future / not-yet-encountered) problems..

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the javadoc and implementation of client-v2/src/main/java/com/clickhouse/client/api/internal/DataTypeConverter.java, then inspect its uses in MapBackedRecord.java and AbstractBinaryFormatReader.java. Trace the mutable state and existing tests to establish the intended thread-safety contract; done should include coverage that exercises the shared INSTANCE safely or documents why it cannot be shared.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api, backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。