elharo opened a new issue, #1997:
URL: https://github.com/apache/maven-resolver/issues/1997
**Affected version:** HEAD
**File:**
`maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/ConcurrentWeakCache.java:124-146`
```java
V existing = get(key); // fast path
if (existing != null) {
return existing;
}
```
The fast-path `get()` uses a ThreadLocal `LookupKey`. Between `get()`
returning null and `merge()` at line 135, another thread can insert a new
value. The merge correctly handles this, but if `get()` returns a non-null
reference to a key that gets GC'd immediately after, we return a stale
reference. This is a correct-by-accident pattern — the merge would fix it, but
we return early.
Originally reported in #1944.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]