apache / apache/iotdb

"targetWriter" is a method parameter, and should not be used for synchronization.

オープン
#5,884 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
Easy-Fixed
主要言語
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
image
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

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

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