"targetWriter" is a method parameter, and should not be used for synchronization.
- Lenguaje dominante
- Java
- Estrellas
- 6.4k
- Forks
- 1.2k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 115
Descripción
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.
Guía de contribución
Línea de trabajo
Empieza en server/src/main/java/org/apache/iotdb/db/engine/compaction/writer/AbstractCompactionWriter.java e inspecciona el método que utiliza targetWriter para la sincronización. Confirma cómo las llamadas concurrentes pueden recibir distintas instancias del parámetro. La tarea estará completada cuando la sincronización ya no dependa de ese parámetro del método y el comportamiento existente siga siendo seguro para las llamadas concurrentes.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- databases
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100