Description
The SortedCopyOnWriteSet implementation uses an internal TreeSet that is copied and replaced on mutation operations. However, in a few areas, SortedCopyOnWriteSet leaks references to the underlying TreeSet implementations, allowing for unsafe usage:
- iterator()
- subSet()
- headSet()
- tailSet()
For Iterator.remove(), we can wrap in an implementation that throws UnsupportedOperationException. For the sub set methods, we could return new SortedCopyOnWriteSet instances (which would not modify the parent set), or wrap with a new sub set implementation that safely allows modification of the parent set.
To be clear, the current usage of SortedCopyOnWriteSet does not make use of any of these non-thread-safe methods, but the implementation should be fixed to be completely thread safe and prevent any new issues.
Attachments
Issue Links
- is related to
-
HBASE-7205 Coprocessor classloader is replicated for all regions in the HRegionServer
- Closed