"targetWriter" is a method parameter, and should not be used for synchronization.
- 主要言語
- Java
- スター
- 6.4k
- フォーク
- 1.2k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 115
説明
Code Path:server/src/main/java/org/apache/iotdb/db/engine/compaction/writer/AbstractCompactionWriter.java
Synchronizing on a class field synchronizes not on the field itself, but on the object assigned to it. So synchronizing on a non-final field makes it possible for the field’s value to change while a thread is in a block synchronized on the old value. That would allow a second thread, synchronized on the new value, to enter the block at the same time.
The story is very similar for synchronizing on parameters; two different threads running the method in parallel could pass two different object instances in to the method as parameters, completely undermining the synchronization.
コントリビューションガイド
調査の方向性
server/src/main/java/org/apache/iotdb/db/engine/compaction/writer/AbstractCompactionWriter.java から始め、同期に targetWriter を使用するメソッドを調べてください。並行呼び出しが異なるパラメーターインスタンスを受け取る可能性がある仕組みを確認してください。このメソッドのパラメーターに同期が依存しなくなり、既存の動作が並行呼び出しに対して引き続き安全であれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100