[ 
https://issues.apache.org/jira/browse/IGNITE-22207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17847310#comment-17847310
 ] 

 Kirill Sizov commented on IGNITE-22207:
----------------------------------------

The solution would be to avoid any activity inside 
{{ReplicaService.pendingInvokes}}, in that case we will never have a case when 
one holds a pendingInvokes monitor and tries to take another one.

In other words we need to take network invoke out of computeIfAbsent.

> Handling of AwaitPrimaryReplica request maight lead to the dedalock
> -------------------------------------------------------------------
>
>                 Key: IGNITE-22207
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22207
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Vladislav Pyatkov
>            Priority: Major
>              Labels: ignite-3
>
> h3. Motivation
> We handle ReplicaUnavailableException in ReplicaService to handle request 
> transparency even if the replica had not been read at the time the request 
> was sent. To do this, we send AwaitReplicaRequest as a handling of the 
> exception and then process the origin request when the replica is guaranteed 
> ready.
> In the event that the AwaitReplicaRequest is handled locally, we will do it 
> synchronously in pendingInvokes.computeIfAbsent:
> {code}
> CompletableFuture<NetworkMessage> awaitReplicaFut = 
> pendingInvokes.computeIfAbsent(
>         targetNodeConsistentId,
>         consistentId -> {
>             AwaitReplicaRequest awaitReplicaReq = 
> REPLICA_MESSAGES_FACTORY.awaitReplicaRequest()
>                     .groupId(req.groupId())
>                     .build();
>             return messagingService.invoke(
>                     targetNodeConsistentId,
>                     awaitReplicaReq,
>                     replicationConfiguration.rpcTimeout().value()
>             );
>         }
> );
> {code}
> and then hands on handling of AwaitReplicaRequest, due to removing from 
> pendingInvokes:
> {code}
> awaitReplicaFut.handle((response0, throwable0) -> {
>     pendingInvokes.remove(targetNodeConsistentId, awaitReplicaFut);
> ...
> {code}
> h3. Definition of doe
> Take out of the network invokation from the map compute closure.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to