I hit live lock condition in concurrent hashmap #computeIfAbsent when function used for computation invokes #computeIfAbsent on the same map.
Conceptually call invocation look like following
final Map<String, Boolean> map = new ConcurrentHashMap<>();
map.computeIfAbsent("k1", k1 -> map.computeIfAbsent("k2", k2 -> Boolean.TRUE));
(with around 3ms of cpu burnt between computes). Unfortunately I can't come up with good unit test for to reproduce problem consistently.
However
there is another live lock which might give some clue is present if computation function tries to remove key on which it's invoked:
final Map<String, Boolean> map = new ConcurrentHashMap<>();
map.computeIfAbsent("k", k -> map.remove("k"));
while 2nd example is rather convoluted use of concurrent hash map, it results in the same stacktrace as first live lock so might be helpful.
Any help will be highly appreciated!