[
https://issues.apache.org/jira/browse/IGNITE-18868?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Konstantin Orlov updated IGNITE-18868:
--------------------------------------
Labels: ignite-3 (was: )
> 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
> Priority: Major
> Labels: ignite-3
>
> 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}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)