google / google/error-prone

Detect a deadlock from a ConcurrentHashMap use

Open
#1,384 0 comments 0 reactions 0 assignees View on GitHub
Type-NewCheck
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

### Description of the feature request:

Detect possible deadlocks from calling CHM's method inside a lambda passed into a `compute()`-like method on the same map:
```java
ConcurrentHashMap map;
map.compute(key, (String k, Integer v) -> {
if (v == null || v == 0) {
return map.get(DEFAULT_KEY); // possible deadlock
}
return v;
});
```

See https://github.com/code-review-checklists/java-concurrency#chm-nested-calls

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.