[ https://issues.apache.org/jira/browse/IGNITE-18868?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vyacheslav Koptilin reassigned IGNITE-18868: -------------------------------------------- Assignee: Vladislav Pyatkov > Recursive update of pendingInvokes in ReplicaService > ---------------------------------------------------- > > Key: IGNITE-18868 > URL: https://issues.apache.org/jira/browse/IGNITE-18868 > Project: Ignite > Issue Type: Bug > Reporter: Konstantin Orlov > Assignee: Vladislav Pyatkov > Priority: Major > Labels: ignite-3 > > h3. Motivation > Take a look at the code below: > {code:java} > // ReplicaService#sendToReplica > if (errResp.throwable() instanceof ReplicaUnavailableException) { > pendingInvokes.compute(targetNodeConsistentId, > (clusterNode, fut) -> { > if (fut == null) { > AwaitReplicaRequest awaitReplicaReq = ... > fut = messagingService.invoke(...) > .whenComplete((response0, throwable0) > -> { > > pendingInvokes.remove(targetNodeConsistentId); > }); > } > {code} > In case {{messagingService}} respond immediately, {{whenComplete}} callback > will be executed in the same thread causing recursive update ({{{}remove{}}} > inside of {{{}compute{}}}) which is not allowed. > {code:java} > Caused by: java.lang.IllegalStateException: Recursive update > at > java.base/java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1167) > at > java.base/java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1102) > at > org.apache.ignite.internal.replicator.ReplicaService.lambda$sendToReplica$0(ReplicaService.java:125) > at > java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859) > at > java.base/java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:883) > at > java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2251) > at > org.apache.ignite.internal.replicator.ReplicaService.lambda$sendToReplica$3(ReplicaService.java:124) > {code} > a > h3. Definition of Done > Need to move > {code:java} > .whenComplete( > (response0, throwable0) -> { > pendingInvokes.remove(targetNodeConsistentId); } > ); > {code} > from the _compute_ block and add it to the future which is returned from the > {_}compute{_}. -- This message was sent by Atlassian Jira (v8.20.10#820010)