Data Race in BlockingFloatHeap
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
There is a data race in `org.apache.lucene.util.hnsw.BlockingFloatHeap`
The variable `size` which for example gets updated `offer` is accessed outside a lock in the method `poll` leading to a data race:
```
public float poll() {
if (size > 0) {
float result;
lock.lock();
```
The data race can be reproduced with VMLens the test case is here:
[VMLens testcase](https://github.com/vmlens/vmlens-examples/blob/master/lucene/src/test/java/org/apache/lucene/util/hnsw/TestBlockingFloatHeap.java)
### Version and environment details
MacOs
JVM 25
Lucence Core 10.3.2
Contributor guide
Research direction
Start by reading org.apache.lucene.util.hnsw.BlockingFloatHeap, especially poll and the size updates described in the issue. Run the linked VMLens testcase to reproduce the race; done means the testcase no longer reports a race while heap operations remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100